File tree Expand file tree Collapse file tree 7 files changed +23
-11
lines changed
Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators
Testably.Abstractions.Testing.Tests Expand file tree Collapse file tree 7 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ public override void SkipIfLongRunningTestsShouldBeSkipped()
133
133
#endif
134
134
}}
135
135
}}" ) ;
136
- if ( ! @class . Namespace . Equals ( "Testably.Abstractions.AccessControl.Tests" , StringComparison . Ordinal ) )
136
+ if ( IncludeSimulatedTests ( @class ) )
137
137
{
138
138
sourceBuilder . Append ( @$ "
139
139
#if !NETFRAMEWORK
@@ -258,4 +258,10 @@ public override void SkipIfLongRunningTestsShouldBeSkipped()
258
258
#endif" ) ;
259
259
}
260
260
}
261
+
262
+ private bool IncludeSimulatedTests ( ClassModel @class )
263
+ {
264
+ return ! @class . Namespace . Equals (
265
+ "Testably.Abstractions.AccessControl.Tests" , StringComparison . Ordinal ) ;
266
+ }
261
267
}
Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ public sealed class PathMockTests
14
14
public void GetTempFileName_WithCollisions_ShouldThrowIOException (
15
15
SimulationMode simulationMode , int fixedRandomValue )
16
16
{
17
+ #pragma warning disable CS0618
17
18
MockFileSystem fileSystem = new ( i => i
18
19
. SimulatingOperatingSystem ( simulationMode )
19
20
. UseRandomProvider ( RandomProvider . Generate (
20
21
intGenerator : new RandomProvider . Generator < int > ( ( ) => fixedRandomValue ) ) ) ) ;
22
+ #pragma warning restore CS0618
21
23
string result = fileSystem . Path . GetTempFileName ( ) ;
22
24
23
25
Exception ? exception = Record . Exception ( ( ) =>
Original file line number Diff line number Diff line change @@ -192,8 +192,10 @@ public void OnWindowsIf_ShouldExecuteDependingOnOperatingSystem(
192
192
193
193
#region Helpers
194
194
195
+ #pragma warning disable CS0618
195
196
private static Execute FromType ( SimulationMode type )
196
197
=> new ( new MockFileSystem ( ) , type ) ;
198
+ #pragma warning restore CS0618
197
199
198
200
#endregion
199
201
}
Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ public sealed class ExecuteTests
7
7
[ Fact ]
8
8
public void Constructor_ForLinux_ShouldInitializeAccordingly ( )
9
9
{
10
+ #pragma warning disable CS0618
10
11
Execute sut = new ( new MockFileSystem ( ) , SimulationMode . Linux ) ;
12
+ #pragma warning restore CS0618
11
13
12
14
sut . IsLinux . Should ( ) . BeTrue ( ) ;
13
15
sut . IsMac . Should ( ) . BeFalse ( ) ;
@@ -19,7 +21,9 @@ public void Constructor_ForLinux_ShouldInitializeAccordingly()
19
21
[ Fact ]
20
22
public void Constructor_ForMacOS_ShouldInitializeAccordingly ( )
21
23
{
24
+ #pragma warning disable CS0618
22
25
Execute sut = new ( new MockFileSystem ( ) , SimulationMode . MacOS ) ;
26
+ #pragma warning restore CS0618
23
27
24
28
sut . IsLinux . Should ( ) . BeFalse ( ) ;
25
29
sut . IsMac . Should ( ) . BeTrue ( ) ;
@@ -31,7 +35,9 @@ public void Constructor_ForMacOS_ShouldInitializeAccordingly()
31
35
[ Fact ]
32
36
public void Constructor_ForWindows_ShouldInitializeAccordingly ( )
33
37
{
38
+ #pragma warning disable CS0618
34
39
Execute sut = new ( new MockFileSystem ( ) , SimulationMode . Windows ) ;
40
+ #pragma warning restore CS0618
35
41
36
42
sut . IsLinux . Should ( ) . BeFalse ( ) ;
37
43
sut . IsMac . Should ( ) . BeFalse ( ) ;
Original file line number Diff line number Diff line change @@ -120,15 +120,14 @@ public void
120
120
. Which . Message . Should ( ) . Contain ( $ "'{ path } '") ;
121
121
}
122
122
123
+ #if ! NETFRAMEWORK
123
124
[ SkippableTheory ]
124
125
[ InlineData ( '|' ) ]
125
126
[ InlineData ( ( char ) 1 ) ]
126
127
[ InlineData ( ( char ) 31 ) ]
127
128
public void ThrowCommonExceptionsIfPathIsInvalid_WithInvalidCharacters (
128
129
char invalidChar )
129
130
{
130
- Skip . If ( Test . IsNetFramework ) ;
131
-
132
131
MockFileSystem fileSystem = new ( i => i
133
132
. SimulatingOperatingSystem ( SimulationMode . Windows ) ) ;
134
133
string path = invalidChar + "path" ;
@@ -137,15 +136,10 @@ public void ThrowCommonExceptionsIfPathIsInvalid_WithInvalidCharacters(
137
136
{
138
137
path . EnsureValidFormat ( fileSystem ) ;
139
138
} ) ;
140
-
141
- #if NETFRAMEWORK
142
- exception . Should ( ) . BeOfType < ArgumentException > ( )
143
- . Which . Message . Should ( ) . Contain ( "path" ) ;
144
- #else
145
139
exception . Should ( ) . BeOfType < IOException > ( )
146
140
. Which . Message . Should ( ) . Contain ( path ) ;
147
- #endif
148
141
}
142
+ #endif
149
143
150
144
[ Fact ]
151
145
public void
Original file line number Diff line number Diff line change 2
2
using System . IO ;
3
3
using System . Linq ;
4
4
using Testably . Abstractions . Testing . Tests . TestHelpers ;
5
- #if NET6_0_OR_GREATER
6
- #endif
7
5
8
6
namespace Testably . Abstractions . Testing . Tests ;
9
7
@@ -93,7 +91,9 @@ public void SimulatingOperatingSystem_ValidOSPlatform_ShouldSetOperatingSystem(
93
91
{
94
92
MockFileSystem . Initialization sut = new ( ) ;
95
93
94
+ #pragma warning disable CS0618
96
95
MockFileSystem . Initialization result = sut . SimulatingOperatingSystem ( simulationMode ) ;
96
+ #pragma warning restore CS0618
97
97
98
98
result . SimulationMode . Should ( ) . Be ( simulationMode ) ;
99
99
sut . SimulationMode . Should ( ) . Be ( simulationMode ) ;
Original file line number Diff line number Diff line change @@ -102,7 +102,9 @@ public void FileSystemMock_ShouldNotSupportSimulatingOtherOperatingSystemsOnNetF
102
102
{
103
103
Exception ? exception = Record . Exception ( ( ) =>
104
104
{
105
+ #pragma warning disable CS0618
105
106
_ = new MockFileSystem ( i => i . SimulatingOperatingSystem ( simulationMode ) ) ;
107
+ #pragma warning restore CS0618
106
108
} ) ;
107
109
108
110
exception . Should ( ) . BeOfType < NotSupportedException > ( )
You can’t perform that action at this time.
0 commit comments