Modernise test tooling and coverage validation
This commit is contained in:
@@ -9,10 +9,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.10.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.10.1" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.10.1" />
|
||||
<PackageReference Include="coverlet.collector" Version="10.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@@ -14,7 +14,6 @@ namespace Sacs.UnitTests.Net.Standard.Base.Data
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static Random random = new Random();
|
||||
private TestContext testContextInstance;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
@@ -27,17 +26,7 @@ namespace Sacs.UnitTests.Net.Standard.Base.Data
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
public TestContext TestContext { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
#region Additional test attributes
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Sacs.UnitTests.Net.Standard.Base.Procs
|
||||
Task runTask = process.RunAsync();
|
||||
Assert.IsTrue(process.Started.Wait(1000), "Process did not start.");
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SaProcess_Base.InProgressException>(() => process.RunAsync());
|
||||
await Assert.ThrowsExactlyAsync<SaProcess_Base.InProgressException>(() => process.RunAsync());
|
||||
|
||||
process.Release.Set();
|
||||
await runTask;
|
||||
@@ -97,7 +97,7 @@ namespace Sacs.UnitTests.Net.Standard.Base.Procs
|
||||
|
||||
Assert.IsFalse(await process.StopProcessAsync(40));
|
||||
Assert.IsTrue(process.IsAsync, "A timed-out stop must retain the active process state.");
|
||||
await Assert.ThrowsExceptionAsync<SaProcess_Base.InProgressException>(() => process.RunAsync());
|
||||
await Assert.ThrowsExactlyAsync<SaProcess_Base.InProgressException>(() => process.RunAsync());
|
||||
|
||||
process.Release.Set();
|
||||
await runTask;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -44,10 +44,9 @@ namespace Sarand.UnitTests.Core.Base.Utils
|
||||
Assert.AreEqual(SaMessageLevel.Debug, EnumUtil.ParseEnum<SaMessageLevel>("Debug"));
|
||||
}
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "Requested value 'ABC' was not found.")]
|
||||
public void EnumUtil_ParseEnum_Exception ()
|
||||
{
|
||||
SaMessageLevel messageLevel = EnumUtil.ParseEnum<SaMessageLevel>("ABC");
|
||||
Assert.ThrowsExactly<ArgumentException>(() => EnumUtil.ParseEnum<SaMessageLevel>("ABC"));
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[TestMethod]
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Sacs.UnitTests.Net.Standard.Base.Utils
|
||||
Assert.IsNotNull(objectException);
|
||||
Assert.IsNull(NewtonsoftJsonUtil.ParseJsonArray("{}", out Exception arrayException));
|
||||
Assert.IsNotNull(arrayException);
|
||||
Assert.ThrowsException<JsonReaderException>(() => NewtonsoftJsonUtil.ParseJsonToken("{"));
|
||||
Assert.ThrowsExactly<JsonReaderException>(() => NewtonsoftJsonUtil.ParseJsonToken("{"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in New Issue
Block a user