File tree Expand file tree Collapse file tree 3 files changed +18
-32
lines changed Expand file tree Collapse file tree 3 files changed +18
-32
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
- #if ! NET40
3
2
using Microsoft . Data . SqlClient ;
4
3
using System . Runtime . InteropServices ;
5
4
6
- #endif
7
-
8
5
namespace SqlAlias
9
6
{
10
7
public static class Aliases
11
8
{
12
- #if NET40
13
- public static string Map ( string connectionString ) => connectionString ;
14
- internal static bool ShouldSubstitute ( ) => false ;
15
- #else
16
9
public static string Map ( string connectionString )
17
10
{
18
11
if ( ! ShouldSubstitute ( ) )
@@ -37,7 +30,5 @@ public static string Map(string connectionString)
37
30
internal static bool ShouldSubstitute ( )
38
31
=> RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) &&
39
32
! RuntimeInformation . FrameworkDescription . StartsWith ( ".NET Framework" ) ;
40
-
41
- #endif
42
33
}
43
34
}
Original file line number Diff line number Diff line change 1
1
using NUnit . Framework ;
2
2
using SqlAlias ;
3
3
4
- namespace Tests
4
+ namespace Tests ;
5
+
6
+ public class AllTheTests
5
7
{
6
- public class AllTheTests
8
+ [ Test ]
9
+ public void CorrectlyDetectsWhetherSubstitutionIsRequired ( )
7
10
{
8
- [ Test ]
9
- public void CorrectlyDetectsWhetherSubstitutionIsRequired ( )
10
- {
11
- var result = Aliases . ShouldSubstitute ( ) ;
12
- #if NET40 || NET45 || NET472
13
- Assert . IsFalse ( result ) ;
14
- #else
15
- Assert . IsTrue ( result ) ;
16
- #endif
17
- }
11
+ var result = Aliases . ShouldSubstitute ( ) ;
12
+ Assert . That ( result , Is . True ) ;
13
+ }
18
14
19
- [ Test ]
20
- public void MapReturnsTheSameConnectionStringIfThereIsNoSubstitute ( )
21
- {
22
- const string connectionString = "Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword" ;
23
- var result = Aliases . Map ( connectionString ) ;
24
- Assert . AreEqual ( connectionString , result ) ;
25
- }
15
+ [ Test ]
16
+ public void MapReturnsTheSameConnectionStringIfThereIsNoSubstitute ( )
17
+ {
18
+ const string connectionString = "Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword" ;
19
+ var result = Aliases . Map ( connectionString ) ;
20
+ Assert . That ( result , Is . EqualTo ( connectionString ) ) ;
26
21
}
27
22
}
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
3
3
<PropertyGroup >
4
- <TargetFrameworks >net40;net45;net472;netcoreapp3.1;net5. 0</TargetFrameworks >
4
+ <TargetFramework >net8. 0</TargetFramework >
5
5
6
6
<IsPackable >false</IsPackable >
7
7
</PropertyGroup >
8
8
9
9
<ItemGroup >
10
10
<ProjectReference Include =" ..\SqlAlias\SqlAlias.csproj" />
11
- <PackageReference Include =" NUnit" Version =" 3.13.1 " />
12
- <PackageReference Include =" NUnit3TestAdapter" Version =" 3.17 .0" />
13
- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.8.3 " />
11
+ <PackageReference Include =" NUnit" Version =" 4.1.0 " />
12
+ <PackageReference Include =" NUnit3TestAdapter" Version =" 4.5 .0" />
13
+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.9.0 " />
14
14
</ItemGroup >
15
15
16
16
</Project >
You can’t perform that action at this time.
0 commit comments