1
1
using System ;
2
2
using System . Diagnostics ;
3
3
using System . Diagnostics . CodeAnalysis ;
4
- using System . Linq ;
5
4
using System . Text ;
6
5
#if FEATURE_FILESYSTEM_NET7
7
6
using Testably . Abstractions . Testing . Storage ;
@@ -284,7 +283,7 @@ public ReadOnlySpan<char> GetPathRoot(ReadOnlySpan<char> path)
284
283
285
284
/// <inheritdoc cref="IPath.GetRandomFileName()" />
286
285
public string GetRandomFileName ( )
287
- => $ "{ RandomString ( 8 ) } .{ RandomString ( 3 ) } ";
286
+ => $ "{ RandomString ( fileSystem , 8 ) } .{ RandomString ( fileSystem , 3 ) } ";
288
287
289
288
#if FEATURE_PATH_RELATIVE
290
289
/// <inheritdoc cref="IPath.GetRelativePath(string, string)" />
@@ -306,7 +305,7 @@ public string GetRelativePath(string relativeTo, string path)
306
305
"Insecure temporary file creation methods should not be used. Use `Path.Combine(Path.GetTempPath(), Path.GetRandomFileName())` instead." ) ]
307
306
#endif
308
307
public string GetTempFileName ( )
309
- => System . IO . Path . GetTempFileName ( ) ;
308
+ => CreateTempFileName ( fileSystem ) ;
310
309
311
310
/// <inheritdoc cref="IPath.GetTempPath()" />
312
311
public abstract string GetTempPath ( ) ;
@@ -573,13 +572,6 @@ private string JoinInternal(string?[] paths)
573
572
574
573
protected abstract string NormalizeDirectorySeparators ( string path ) ;
575
574
576
- protected string RandomString ( int length )
577
- {
578
- const string chars = "abcdefghijklmnopqrstuvwxyz0123456789" ;
579
- return new string ( Enumerable . Repeat ( chars , length )
580
- . Select ( s => s [ fileSystem . RandomSystem . Random . Shared . Next ( s . Length ) ] ) . ToArray ( ) ) ;
581
- }
582
-
583
575
/// <summary>
584
576
/// Remove relative segments from the given path (without combining with a root).
585
577
/// </summary>
0 commit comments