@@ -6,31 +6,6 @@ namespace Testably.Abstractions.Testing.Helpers;
66
77internal static class ExceptionFactory
88{
9- public static ArgumentException HandleIsInvalid ( string ? paramName = "handle" )
10- => new ( "Invalid handle." , paramName ) ;
11-
12- public static IOException MoveSourceMustBeDifferentThanDestination ( )
13- => new ( "Source and destination path must be different." , - 2146232800 ) ;
14-
15- public static NotSupportedException NotSupportedFileStreamWrapping ( )
16- => new ( "You cannot wrap an existing FileStream in the MockFileSystem instance!" ) ;
17-
18- public static NotSupportedException NotSupportedSafeFileHandle ( )
19- => new (
20- "You cannot mock a safe file handle in the mocked file system without registering a strategy explicitly. Use `MockFileSystem.WithSafeFileHandleStrategy`!" ) ;
21-
22- public static NotSupportedException NotSupportedTimerWrapping ( )
23- => new ( "You cannot wrap an existing Timer in the MockTimeSystem instance!" ) ;
24-
25- public static ArgumentException SearchPatternCannotContainTwoDots ( )
26- => new (
27- "Search pattern cannot contain \" ..\" to move up directories and can be contained only internally in file/directory names, as in \" a..b\" ." ) ;
28-
29- public static IOException SeekBackwardNotPossibleInAppendMode ( )
30- => new (
31- "Unable seek backward to overwrite data that previously existed in a file opened in Append mode." ,
32- - 2146232800 ) ;
33-
349 internal static UnauthorizedAccessException AccessToPathDenied ( string path = "" )
3510 => new ( string . IsNullOrEmpty ( path )
3611 ? "Access to the path is denied."
@@ -105,6 +80,9 @@ internal static FileNotFoundException FileNotFound(string path)
10580#endif
10681 } ;
10782
83+ internal static ArgumentException HandleIsInvalid ( string ? paramName = "handle" )
84+ => new ( "Invalid handle." , paramName ) ;
85+
10886 internal static InternalBufferOverflowException InternalBufferOverflowException (
10987 int internalBufferSize , int messages )
11088 => new (
@@ -130,12 +108,25 @@ internal static ArgumentException InvalidDriveName(string paramName = "driveName
130108#endif
131109 } ;
132110
111+ internal static IOException MoveSourceMustBeDifferentThanDestination ( )
112+ => new ( "Source and destination path must be different." , - 2146232800 ) ;
113+
133114 internal static IOException NetworkPathNotFound ( string path )
134115 => new ( $ "The network path was not found. : '{ path } '") ;
135116
136117 internal static IOException NotEnoughDiskSpace ( string name )
137118 => new ( $ "There is not enough space on the disk: '{ name } '") ;
138119
120+ internal static NotSupportedException NotSupportedFileStreamWrapping ( )
121+ => new ( "You cannot wrap an existing FileStream in the MockFileSystem instance!" ) ;
122+
123+ internal static NotSupportedException NotSupportedSafeFileHandle ( )
124+ => new (
125+ "You cannot mock a safe file handle in the mocked file system without registering a strategy explicitly. Use `MockFileSystem.WithSafeFileHandleStrategy`!" ) ;
126+
127+ internal static NotSupportedException NotSupportedTimerWrapping ( )
128+ => new ( "You cannot wrap an existing Timer in the MockTimeSystem instance!" ) ;
129+
139130 internal static PlatformNotSupportedException OperationNotSupportedOnThisPlatform ( )
140131 => new ( "Operation is not supported on this platform." )
141132 {
@@ -190,7 +181,16 @@ internal static IOException ProcessCannotAccessTheFile(string path, int hResult)
190181 $ "The process cannot access the file '{ path } ' because it is being used by another process.",
191182 hResult ) ;
192183
193- public static NotSupportedException StreamDoesNotSupportReading ( )
184+ internal static ArgumentException SearchPatternCannotContainTwoDots ( )
185+ => new (
186+ "Search pattern cannot contain \" ..\" to move up directories and can be contained only internally in file/directory names, as in \" a..b\" ." ) ;
187+
188+ internal static IOException SeekBackwardNotPossibleInAppendMode ( )
189+ => new (
190+ "Unable seek backward to overwrite data that previously existed in a file opened in Append mode." ,
191+ - 2146232800 ) ;
192+
193+ internal static NotSupportedException StreamDoesNotSupportReading ( )
194194 => new ( "Stream does not support reading." )
195195 {
196196#if FEATURE_EXCEPTION_HRESULT
@@ -236,7 +236,7 @@ internal static TimeoutException TimeoutExpired(int timeoutMilliseconds)
236236 => new (
237237 $ "The timeout of { timeoutMilliseconds } ms expired in the awaitable callback.") ;
238238
239- public static ArgumentOutOfRangeException TimerArgumentOutOfRange ( string propertyName )
239+ internal static ArgumentOutOfRangeException TimerArgumentOutOfRange ( string propertyName )
240240 => new ( propertyName ,
241241 "Number must be either non-negative and less than or equal to Int32.MaxValue or -1" )
242242 {
0 commit comments