Skip to content

Commit 14a8d3d

Browse files
committed
Use 'dotnet test' instead of 'dotnet xunit'.
'dotnet xunit' is deprecated in xUnit 2.4. Fix bugs found by actually running test on .NET Core 1.1.
1 parent 5ca7eba commit 14a8d3d

File tree

8 files changed

+55
-23
lines changed

8 files changed

+55
-23
lines changed

.ci/test.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ if ($LASTEXITCODE -ne 0){
1212

1313
echo "Executing unit tests"
1414
pushd tests\MySqlConnector.Tests
15-
dotnet xunit -c Release
15+
dotnet test -c Release
1616
if ($LASTEXITCODE -ne 0){
1717
exit $LASTEXITCODE;
1818
}
1919
popd
2020
pushd tests\Conformance.Tests
21-
dotnet xunit -c Release
21+
dotnet test -c Release
2222
if ($LASTEXITCODE -ne 0){
2323
exit $LASTEXITCODE;
2424
}
@@ -28,14 +28,14 @@ pushd .\tests\SideBySide
2828

2929
echo "Executing tests with No Compression, No SSL"
3030
Copy-Item -Force ..\..\.ci\config\config.json config.json
31-
dotnet xunit -c Release
31+
dotnet test -c Release
3232
if ($LASTEXITCODE -ne 0){
3333
exit $LASTEXITCODE;
3434
}
3535

3636
echo "Executing tests with Compression, No SSL"
3737
Copy-Item -Force ..\..\.ci\config\config.compression.json config.json
38-
dotnet xunit -c Release -f netcoreapp2.0
38+
dotnet test -c Release -f netcoreapp2.0
3939
if ($LASTEXITCODE -ne 0){
4040
exit $LASTEXITCODE;
4141
}

.travis.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ before_install:
2929

3030
script:
3131
- dotnet restore
32-
- pushd tests/MySqlConnector.Tests && dotnet xunit -c Release && popd
33-
- pushd tests/Conformance.Tests && CONNECTION_STRING="Server=localhost;Port=3307;User Id=mysqltest;Password='test;key=\"val';SSL Mode=None" dotnet xunit -c Release && popd
32+
- pushd tests/MySqlConnector.Tests && dotnet test -c Release && popd
33+
- pushd tests/Conformance.Tests && CONNECTION_STRING="Server=localhost;Port=3307;User Id=mysqltest;Password='test;key=\"val';SSL Mode=None" dotnet test -c Release && popd
3434
- pushd tests/SideBySide
3535
- dotnet build SideBySide.csproj -c Release -f netcoreapp2.0
36-
- echo 'Executing netcoreapp1.1.2 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet xunit -c Release -f netcoreapp1.1.2
37-
- echo 'Executing netcoreapp2.0 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
38-
- echo 'Executing netcoreapp2.0 tests with Compression, No SSL' && ../../.ci/use-config.sh config.compression.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
39-
- echo 'Executing netcoreapp1.1.2 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet xunit -c Release -f netcoreapp1.1.2
40-
- echo 'Executing netcoreapp2.0 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
41-
- echo 'Executing netcoreapp2.0 tests with Compression, SSL' && ../../.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
42-
- echo 'Executing netcoreapp2.0 tests with Unix Domain Socket, No Compression, No SSL' && ../../.ci/use-config.sh config.uds.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
36+
- echo 'Executing netcoreapp1.1.2 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp1.1.2
37+
- echo 'Executing netcoreapp2.0 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
38+
- echo 'Executing netcoreapp2.0 tests with Compression, No SSL' && ../../.ci/use-config.sh config.compression.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
39+
- echo 'Executing netcoreapp1.1.2 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp1.1.2
40+
- echo 'Executing netcoreapp2.0 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
41+
- echo 'Executing netcoreapp2.0 tests with Compression, SSL' && ../../.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
42+
- echo 'Executing netcoreapp2.0 tests with Unix Domain Socket, No Compression, No SSL' && ../../.ci/use-config.sh config.uds.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
4343
- popd
4444

4545
after_script:

src/MySqlConnector/MySql.Data.MySqlClient/MySqlParameter.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ public override ParameterDirection Direction
9999
public override bool IsNullable { get; set; }
100100

101101
#if NET45
102-
#pragma warning disable 109 // no existing member for 'new' to hide
102+
public byte Precision { get; set; }
103+
public byte Scale { get; set; }
104+
#else
105+
public override byte Precision { get; set; }
106+
public override byte Scale { get; set; }
103107
#endif
104-
public new byte Precision { get; set; }
105-
public new byte Scale { get; set; }
106108

107109
public override string ParameterName
108110
{

tests/Conformance.Tests/Conformance.Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
88
<AssemblyOriginatorKeyFile>..\..\MySqlConnector.snk</AssemblyOriginatorKeyFile>
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
10-
<RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
1110
</PropertyGroup>
1211

1312
<ItemGroup>
1413
<PackageReference Include="AdoNet.Specification.Tests" Version="2.0.0-alpha1" />
1514
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
1615
<PackageReference Include="xunit" Version="2.3.1" />
1716
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
18-
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
1917
<ProjectReference Include="..\..\src\MySqlConnector\MySqlConnector.csproj" />
2018
</ItemGroup>
2119

tests/MySqlConnector.Tests/MySqlConnector.Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
<AssemblyName>MySqlConnector.Tests</AssemblyName>
1919
<PackageId>MySqlConnector.Tests</PackageId>
2020
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
21-
<RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
2221
</PropertyGroup>
2322

2423
<ItemGroup>
2524
<PackageReference Include="xunit" Version="2.3.1" />
26-
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
2725
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
2826
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
2927
</ItemGroup>

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ To run the tests against MySqlConnector:
4949

5050
```
5151
cd tests\SideBySide
52-
dotnet xunit -c Release
52+
dotnet test -c Release
5353
```
5454

5555
To run the tests against MySql.Data:

tests/SideBySide/ParameterTests.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,24 @@ public void PrecisionViaBaseClass()
289289
Assert.Equal((byte) 11, parameter.Precision);
290290
}
291291

292+
[Fact]
293+
public void PrecisionDirect()
294+
{
295+
MySqlCommand command = new MySqlCommand();
296+
MySqlParameter parameter = command.CreateParameter();
297+
parameter.Precision = 11;
298+
Assert.Equal((byte) 11, parameter.Precision);
299+
}
300+
301+
[Fact]
302+
public void PrecisionMixed()
303+
{
304+
MySqlCommand command = new MySqlCommand();
305+
DbParameter parameter = command.CreateParameter();
306+
((IDbDataParameter) parameter).Precision = 11;
307+
Assert.Equal((byte) 11, ((MySqlParameter) parameter).Precision);
308+
}
309+
292310
[Fact]
293311
public void ScaleViaInterface()
294312
{
@@ -306,5 +324,23 @@ public void ScaleViaBaseClass()
306324
parameter.Scale = 12;
307325
Assert.Equal((byte) 12, parameter.Scale);
308326
}
327+
328+
[Fact]
329+
public void ScaleDirect()
330+
{
331+
MySqlCommand command = new MySqlCommand();
332+
MySqlParameter parameter = command.CreateParameter();
333+
parameter.Scale = 12;
334+
Assert.Equal((byte) 12, parameter.Scale);
335+
}
336+
337+
[Fact]
338+
public void ScaleMixed()
339+
{
340+
MySqlCommand command = new MySqlCommand();
341+
DbParameter parameter = command.CreateParameter();
342+
((IDbDataParameter) parameter).Scale = 12;
343+
Assert.Equal((byte) 12, ((MySqlParameter) parameter).Scale);
344+
}
309345
}
310346
}

tests/SideBySide/SideBySide.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
2121
<ServerGarbageCollection>true</ServerGarbageCollection>
2222
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
2323
<ThreadPoolMinThreads>64</ThreadPoolMinThreads>
24-
<RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
2524
</PropertyGroup>
2625

2726
<ItemGroup>
2827
<!--testing packages-->
2928
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
3029
<PackageReference Include="xunit" Version="2.3.1" />
3130
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
32-
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
3331
<!--app packages-->
3432
<PackageReference Include="Dapper.StrongName" Version="1.50.2" />
3533
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="1.1.1" />

0 commit comments

Comments
 (0)