Updating to VS 2026
This commit is contained in:
@@ -47,7 +47,7 @@ test-debug:
|
|||||||
- dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
|
- dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
|
||||||
script:
|
script:
|
||||||
- dotnet test -c Debug --nologo /p:CoverletOutputFormat=Cobertura
|
- dotnet test -c Debug --nologo /p:CoverletOutputFormat=Cobertura
|
||||||
- /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" -reportType:TextSummary
|
- /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" "-reportType:TextSummary"
|
||||||
after_script:
|
after_script:
|
||||||
- cat /reports/Summary.txt
|
- cat /reports/Summary.txt
|
||||||
artifacts:
|
artifacts:
|
||||||
@@ -107,7 +107,7 @@ test-release:
|
|||||||
- dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
|
- dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
|
||||||
script:
|
script:
|
||||||
- dotnet test -c Release --nologo /p:CoverletOutputFormat=Cobertura
|
- dotnet test -c Release --nologo /p:CoverletOutputFormat=Cobertura
|
||||||
- /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" -reportType:TextSummary
|
- /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" "-reportType:TextSummary"
|
||||||
after_script:
|
after_script:
|
||||||
- cat /reports/Summary.txt
|
- cat /reports/Summary.txt
|
||||||
artifacts:
|
artifacts:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 18
|
||||||
VisualStudioVersion = 17.0.31903.59
|
VisualStudioVersion = 18.0.11205.157
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F2C7556A-99EB-43EB-8954-56A24AFE928F}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F2C7556A-99EB-43EB-8954-56A24AFE928F}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
@@ -11,6 +11,7 @@ EndProject
|
|||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E5DF156A-6C8B-4004-BA4C-A8DDE6FD3ECD}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E5DF156A-6C8B-4004-BA4C-A8DDE6FD3ECD}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
test\Directory.Build.props = test\Directory.Build.props
|
test\Directory.Build.props = test\Directory.Build.props
|
||||||
|
test\MSTestSettings.cs = test\MSTestSettings.cs
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common", "src\AMWD.Common\AMWD.Common.csproj", "{F512C474-B670-4E47-911E-7C0674AA8E7E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common", "src\AMWD.Common\AMWD.Common.csproj", "{F512C474-B670-4E47-911E-7C0674AA8E7E}"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AMWD.NetRevisionTask" Version="1.2.1">
|
<PackageReference Include="AMWD.NetRevisionTask" Version="1.3.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\MSTestSettings.cs" Link="MSTestSettings.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\AMWD.Common.AspNetCore\AMWD.Common.AspNetCore.csproj" />
|
<ProjectReference Include="..\..\src\AMWD.Common.AspNetCore\AMWD.Common.AspNetCore.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
|
|
||||||
var actionDescriptor = new ActionDescriptor
|
var actionDescriptor = new ActionDescriptor
|
||||||
{
|
{
|
||||||
EndpointMetadata = new List<object>()
|
EndpointMetadata = []
|
||||||
};
|
};
|
||||||
if (isAnonymousAllowed)
|
if (isAnonymousAllowed)
|
||||||
actionDescriptor.EndpointMetadata.Add(new AllowAnonymousAttribute());
|
actionDescriptor.EndpointMetadata.Add(new AllowAnonymousAttribute());
|
||||||
@@ -346,7 +346,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
HttpContext = _contextMock.Object,
|
HttpContext = _contextMock.Object,
|
||||||
RouteData = routeDataMock.Object,
|
RouteData = routeDataMock.Object,
|
||||||
ActionDescriptor = actionDescriptor,
|
ActionDescriptor = actionDescriptor,
|
||||||
}, new List<IFilterMetadata>());
|
}, []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsTrue(context.Result is StatusCodeResult);
|
Assert.IsTrue(context.Result is StatusCodeResult);
|
||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsTrue(context.Result is StatusCodeResult);
|
Assert.IsTrue(context.Result is StatusCodeResult);
|
||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,11 +107,11 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsTrue(context.Result is StatusCodeResult);
|
Assert.IsTrue(context.Result is StatusCodeResult);
|
||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("192.168.178.10")]
|
[DataRow("192.168.178.10")]
|
||||||
[DataRow("192.168.178.20")]
|
[DataRow("192.168.178.20")]
|
||||||
public void ShouldAllowSpecificAddress(string address)
|
public void ShouldAllowSpecificAddress(string address)
|
||||||
@@ -140,7 +140,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +191,11 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsTrue(context.Result is StatusCodeResult);
|
Assert.IsTrue(context.Result is StatusCodeResult);
|
||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("192.168.178.10")]
|
[DataRow("192.168.178.10")]
|
||||||
[DataRow("192.168.178.20")]
|
[DataRow("192.168.178.20")]
|
||||||
public void ShouldAllowSpecificAddressConfig(string address)
|
public void ShouldAllowSpecificAddressConfig(string address)
|
||||||
@@ -227,7 +227,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsTrue(context.Result is StatusCodeResult);
|
Assert.IsTrue(context.Result is StatusCodeResult);
|
||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
HttpContext = contextMock.Object,
|
HttpContext = contextMock.Object,
|
||||||
RouteData = routeDataMock.Object,
|
RouteData = routeDataMock.Object,
|
||||||
ActionDescriptor = actionDescriptorMock.Object,
|
ActionDescriptor = actionDescriptorMock.Object,
|
||||||
}, new List<IFilterMetadata>(), new Dictionary<string, object>(), null);
|
}, [], new Dictionary<string, object>(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,11 +106,11 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsTrue(context.Result is StatusCodeResult);
|
Assert.IsTrue(context.Result is StatusCodeResult);
|
||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("192.168.178.10")]
|
[DataRow("192.168.178.10")]
|
||||||
[DataRow("192.168.178.20")]
|
[DataRow("192.168.178.20")]
|
||||||
public void ShouldBlockSpecificAddress(string address)
|
public void ShouldBlockSpecificAddress(string address)
|
||||||
@@ -139,7 +139,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +191,11 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsTrue(context.Result is StatusCodeResult);
|
Assert.IsTrue(context.Result is StatusCodeResult);
|
||||||
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
Assert.AreEqual(403, ((StatusCodeResult)context.Result).StatusCode);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("192.168.178.10")]
|
[DataRow("192.168.178.10")]
|
||||||
[DataRow("192.168.178.20")]
|
[DataRow("192.168.178.20")]
|
||||||
public void ShouldBlockSpecificAddressConfig(string address)
|
public void ShouldBlockSpecificAddressConfig(string address)
|
||||||
@@ -228,7 +228,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(remote, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ namespace AMWD.Common.AspNetCore.Tests.Attributes
|
|||||||
// assert
|
// assert
|
||||||
Assert.IsNull(context.Result);
|
Assert.IsNull(context.Result);
|
||||||
|
|
||||||
Assert.AreEqual(1, _itemsCallback.Count);
|
Assert.HasCount(1, _itemsCallback);
|
||||||
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
Assert.AreEqual(IPAddress.Loopback, _itemsCallback["RemoteAddress"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace AMWD.Common.AspNetCore.Tests.Extensions
|
|||||||
Assert.AreEqual(_remote, result);
|
Assert.AreEqual(_remote, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("Cf-Connecting-Ip")]
|
[DataRow("Cf-Connecting-Ip")]
|
||||||
[DataRow("X-Real-IP")]
|
[DataRow("X-Real-IP")]
|
||||||
[DataRow("X-Forwarded-For")]
|
[DataRow("X-Forwarded-For")]
|
||||||
|
|||||||
@@ -55,25 +55,23 @@ namespace AMWD.Common.AspNetCore.Tests.Extensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
|
||||||
public void ShouldThrowArgumentNull()
|
public void ShouldThrowArgumentNull()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
ModelStateDictionary modelState = null;
|
ModelStateDictionary modelState = null;
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
modelState.AddModelError(_testModel, m => m.SubModel.SubValueB, "ShitHappens");
|
Assert.ThrowsExactly<ArgumentNullException>(() => modelState.AddModelError(_testModel, m => m.SubModel.SubValueB, "ShitHappens"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(InvalidOperationException))]
|
|
||||||
public void ShouldThrowInvalidOperation()
|
public void ShouldThrowInvalidOperation()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var modelState = new ModelStateDictionary();
|
var modelState = new ModelStateDictionary();
|
||||||
|
|
||||||
// act
|
// act
|
||||||
modelState.AddModelError(_testModel, m => m, "ShitHappens");
|
Assert.ThrowsExactly<InvalidOperationException>(() => modelState.AddModelError(_testModel, m => m, "ShitHappens"));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class TestModel
|
internal class TestModel
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ namespace AMWD.Common.AspNetCore.Tests.Extensions
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
Assert.AreEqual(null, result.ValueA);
|
Assert.IsNull(result.ValueA);
|
||||||
Assert.AreEqual(null, result.ValueB);
|
Assert.IsNull(result.ValueB);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ namespace AMWD.Common.AspNetCore.Tests.Security.BasicAuthentication
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(0, _responseStatusCodeCallback); // not triggered
|
Assert.AreEqual(0, _responseStatusCodeCallback); // not triggered
|
||||||
Assert.AreEqual(0, _responseHeadersCallback.Count);
|
Assert.IsEmpty(_responseHeadersCallback);
|
||||||
Assert.AreEqual(1, _validatorCallback.Count);
|
Assert.HasCount(1, _validatorCallback);
|
||||||
|
|
||||||
Assert.AreEqual(username, _validatorCallback.First().username);
|
Assert.AreEqual(username, _validatorCallback.First().username);
|
||||||
Assert.AreEqual(password, _validatorCallback.First().password);
|
Assert.AreEqual(password, _validatorCallback.First().password);
|
||||||
@@ -78,9 +78,9 @@ namespace AMWD.Common.AspNetCore.Tests.Security.BasicAuthentication
|
|||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(401, _responseStatusCodeCallback);
|
Assert.AreEqual(401, _responseStatusCodeCallback);
|
||||||
|
|
||||||
Assert.AreEqual(0, _validatorCallback.Count);
|
Assert.IsEmpty(_validatorCallback);
|
||||||
|
|
||||||
Assert.AreEqual(1, _responseHeadersCallback.Count);
|
Assert.HasCount(1, _responseHeadersCallback);
|
||||||
Assert.AreEqual("WWW-Authenticate", _responseHeadersCallback.Keys.First());
|
Assert.AreEqual("WWW-Authenticate", _responseHeadersCallback.Keys.First());
|
||||||
Assert.AreEqual("Basic", _responseHeadersCallback.Values.First());
|
Assert.AreEqual("Basic", _responseHeadersCallback.Values.First());
|
||||||
}
|
}
|
||||||
@@ -106,11 +106,11 @@ namespace AMWD.Common.AspNetCore.Tests.Security.BasicAuthentication
|
|||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(401, _responseStatusCodeCallback);
|
Assert.AreEqual(401, _responseStatusCodeCallback);
|
||||||
|
|
||||||
Assert.AreEqual(1, _responseHeadersCallback.Count);
|
Assert.HasCount(1, _responseHeadersCallback);
|
||||||
Assert.AreEqual("WWW-Authenticate", _responseHeadersCallback.Keys.First());
|
Assert.AreEqual("WWW-Authenticate", _responseHeadersCallback.Keys.First());
|
||||||
Assert.AreEqual($"Basic realm=\"{_validatorRealm}\"", _responseHeadersCallback.Values.First());
|
Assert.AreEqual($"Basic realm=\"{_validatorRealm}\"", _responseHeadersCallback.Values.First());
|
||||||
|
|
||||||
Assert.AreEqual(1, _validatorCallback.Count);
|
Assert.HasCount(1, _validatorCallback);
|
||||||
Assert.AreEqual(username, _validatorCallback.First().username);
|
Assert.AreEqual(username, _validatorCallback.First().username);
|
||||||
Assert.AreEqual(password, _validatorCallback.First().password);
|
Assert.AreEqual(password, _validatorCallback.First().password);
|
||||||
Assert.AreEqual(remote, _validatorCallback.First().ipAddr);
|
Assert.AreEqual(remote, _validatorCallback.First().ipAddr);
|
||||||
|
|||||||
@@ -7,32 +7,30 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
public class HtmlHelperTest
|
public class HtmlHelperTest
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
[DataRow(null)]
|
||||||
public void ShouldThrowErrorOnEmptyColor()
|
[DataRow("")]
|
||||||
|
[DataRow(" ")]
|
||||||
|
public void ShouldThrowErrorOnEmptyColor(string color)
|
||||||
|
{
|
||||||
|
// arrange
|
||||||
|
|
||||||
|
// act & assert
|
||||||
|
Assert.ThrowsExactly<ArgumentNullException>(() => HtmlHelper.IsDarkColor(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void ShouldThrowErrorOnUnsupportedColor()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
|
|
||||||
// act
|
// act
|
||||||
HtmlHelper.IsDarkColor("");
|
Assert.ThrowsExactly<NotSupportedException>(() => HtmlHelper.IsDarkColor("hsv(1, 2, 3)"));
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
// exception thrown
|
// exception thrown
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(NotSupportedException))]
|
|
||||||
public void ShouldThrowErrorOnUnsupportedColor()
|
|
||||||
{
|
|
||||||
// arrange
|
|
||||||
|
|
||||||
// act
|
|
||||||
HtmlHelper.IsDarkColor("hsv(1, 2, 3)");
|
|
||||||
|
|
||||||
// assert
|
|
||||||
// exception thrown
|
|
||||||
}
|
|
||||||
|
|
||||||
[DataTestMethod]
|
|
||||||
[DataRow("rgb(255, 255, 255)")]
|
[DataRow("rgb(255, 255, 255)")]
|
||||||
[DataRow("rgba(255, 255, 255, .5)")]
|
[DataRow("rgba(255, 255, 255, .5)")]
|
||||||
public void ShouldReturnLightColorForWhiteRgb(string white)
|
public void ShouldReturnLightColorForWhiteRgb(string white)
|
||||||
@@ -46,7 +44,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
Assert.IsFalse(isDark);
|
Assert.IsFalse(isDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("#ffFFff")]
|
[DataRow("#ffFFff")]
|
||||||
[DataRow("FFffFF")]
|
[DataRow("FFffFF")]
|
||||||
public void ShouldReturnLightColorForWhiteFullHex(string white)
|
public void ShouldReturnLightColorForWhiteFullHex(string white)
|
||||||
@@ -60,7 +58,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
Assert.IsFalse(isDark);
|
Assert.IsFalse(isDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("#fFf")]
|
[DataRow("#fFf")]
|
||||||
[DataRow("FfF")]
|
[DataRow("FfF")]
|
||||||
public void ShouldReturnLightColorForWhiteShortHex(string white)
|
public void ShouldReturnLightColorForWhiteShortHex(string white)
|
||||||
@@ -74,7 +72,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
Assert.IsFalse(isDark);
|
Assert.IsFalse(isDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("rgb(0, 0, 0)")]
|
[DataRow("rgb(0, 0, 0)")]
|
||||||
[DataRow("rgba(0, 0, 0, .5)")]
|
[DataRow("rgba(0, 0, 0, .5)")]
|
||||||
public void ShouldReturnDarkColorForBlackRgb(string black)
|
public void ShouldReturnDarkColorForBlackRgb(string black)
|
||||||
@@ -88,7 +86,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
Assert.IsTrue(isDark);
|
Assert.IsTrue(isDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("#000000")]
|
[DataRow("#000000")]
|
||||||
[DataRow("000000")]
|
[DataRow("000000")]
|
||||||
public void ShouldReturnDarkColorForBlackFullHex(string black)
|
public void ShouldReturnDarkColorForBlackFullHex(string black)
|
||||||
@@ -102,7 +100,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
Assert.IsTrue(isDark);
|
Assert.IsTrue(isDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("#000")]
|
[DataRow("#000")]
|
||||||
[DataRow("000")]
|
[DataRow("000")]
|
||||||
public void ShouldReturnDarkColorForBlackShortHex(string black)
|
public void ShouldReturnDarkColorForBlackShortHex(string black)
|
||||||
@@ -116,7 +114,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
Assert.IsTrue(isDark);
|
Assert.IsTrue(isDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("rgb(255, 88, 0)")]
|
[DataRow("rgb(255, 88, 0)")]
|
||||||
[DataRow("rgb(0, 218, 0)")]
|
[DataRow("rgb(0, 218, 0)")]
|
||||||
[DataRow("rgb(0, 168, 255)")]
|
[DataRow("rgb(0, 168, 255)")]
|
||||||
@@ -133,7 +131,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
Assert.IsFalse(isDark);
|
Assert.IsFalse(isDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("rgb(253, 88, 0)")]
|
[DataRow("rgb(253, 88, 0)")]
|
||||||
[DataRow("rgb(0, 217, 0)")]
|
[DataRow("rgb(0, 217, 0)")]
|
||||||
[DataRow("rgb(0, 168, 253)")]
|
[DataRow("rgb(0, 168, 253)")]
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
|
|||||||
string hash = PasswordHelper.HashPassword(password);
|
string hash = PasswordHelper.HashPassword(password);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsTrue(!string.IsNullOrWhiteSpace(hash));
|
Assert.IsFalse(string.IsNullOrWhiteSpace(hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\MSTestSettings.cs" Link="MSTestSettings.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DNS" Version="7.0.0" />
|
<PackageReference Include="DNS" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
Assert.AreEqual(9, result.Length);
|
Assert.HasCount(9, result);
|
||||||
|
|
||||||
Assert.AreEqual("Option1", result[0]);
|
Assert.AreEqual("Option1", result[0]);
|
||||||
Assert.AreEqual("Option 2", result[1]);
|
Assert.AreEqual("Option 2", result[1]);
|
||||||
@@ -44,7 +44,7 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNotNull(args);
|
Assert.IsNotNull(args);
|
||||||
Assert.AreEqual(2, args.Length);
|
Assert.HasCount(2, args);
|
||||||
|
|
||||||
Assert.AreEqual("Option1", args[0]);
|
Assert.AreEqual("Option1", args[0]);
|
||||||
Assert.AreEqual("Option 2", args[1]);
|
Assert.AreEqual("Option 2", args[1]);
|
||||||
@@ -66,27 +66,27 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNotNull(options);
|
Assert.IsNotNull(options);
|
||||||
Assert.AreEqual(4, options.Count);
|
Assert.HasCount(4, options);
|
||||||
|
|
||||||
Assert.AreEqual(1, options.ElementAt(0).Names.Count);
|
Assert.HasCount(1, options.ElementAt(0).Names);
|
||||||
Assert.AreEqual("opt1", options.ElementAt(0).Names.First());
|
Assert.AreEqual("opt1", options.ElementAt(0).Names.First());
|
||||||
Assert.AreEqual(0, options.ElementAt(0).ParameterCount);
|
Assert.AreEqual(0, options.ElementAt(0).ParameterCount);
|
||||||
Assert.IsFalse(options.ElementAt(0).IsSingle);
|
Assert.IsFalse(options.ElementAt(0).IsSingle);
|
||||||
Assert.IsFalse(options.ElementAt(0).IsRequired);
|
Assert.IsFalse(options.ElementAt(0).IsRequired);
|
||||||
|
|
||||||
Assert.AreEqual(1, options.ElementAt(1).Names.Count);
|
Assert.HasCount(1, options.ElementAt(1).Names);
|
||||||
Assert.AreEqual("opt2", options.ElementAt(1).Names.First());
|
Assert.AreEqual("opt2", options.ElementAt(1).Names.First());
|
||||||
Assert.AreEqual(1, options.ElementAt(1).ParameterCount);
|
Assert.AreEqual(1, options.ElementAt(1).ParameterCount);
|
||||||
Assert.IsFalse(options.ElementAt(1).IsSingle);
|
Assert.IsFalse(options.ElementAt(1).IsSingle);
|
||||||
Assert.IsFalse(options.ElementAt(1).IsRequired);
|
Assert.IsFalse(options.ElementAt(1).IsRequired);
|
||||||
|
|
||||||
Assert.AreEqual(1, options.ElementAt(2).Names.Count);
|
Assert.HasCount(1, options.ElementAt(2).Names);
|
||||||
Assert.AreEqual("opt3", options.ElementAt(2).Names.First());
|
Assert.AreEqual("opt3", options.ElementAt(2).Names.First());
|
||||||
Assert.AreEqual(2, options.ElementAt(2).ParameterCount);
|
Assert.AreEqual(2, options.ElementAt(2).ParameterCount);
|
||||||
Assert.IsTrue(options.ElementAt(2).IsSingle);
|
Assert.IsTrue(options.ElementAt(2).IsSingle);
|
||||||
Assert.IsTrue(options.ElementAt(2).IsRequired);
|
Assert.IsTrue(options.ElementAt(2).IsRequired);
|
||||||
|
|
||||||
Assert.AreEqual(2, options.ElementAt(3).Names.Count);
|
Assert.HasCount(2, options.ElementAt(3).Names);
|
||||||
Assert.AreEqual("opt4", options.ElementAt(3).Names.First());
|
Assert.AreEqual("opt4", options.ElementAt(3).Names.First());
|
||||||
Assert.AreEqual("option4", options.ElementAt(3).Names.Last());
|
Assert.AreEqual("option4", options.ElementAt(3).Names.Last());
|
||||||
Assert.AreEqual(0, options.ElementAt(3).ParameterCount);
|
Assert.AreEqual(0, options.ElementAt(3).ParameterCount);
|
||||||
@@ -115,45 +115,45 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsFalse(opt.IsSet);
|
Assert.IsFalse(opt.IsSet);
|
||||||
Assert.AreEqual(7, parser.Arguments.Length);
|
Assert.HasCount(7, parser.Arguments);
|
||||||
Assert.AreEqual(2, parser.FreeArguments.Length);
|
Assert.HasCount(2, parser.FreeArguments);
|
||||||
|
|
||||||
Assert.AreEqual("foo", parser.FreeArguments.First());
|
Assert.AreEqual("foo", parser.FreeArguments.First());
|
||||||
Assert.AreEqual("bar", parser.FreeArguments.Last());
|
Assert.AreEqual("bar", parser.FreeArguments.Last());
|
||||||
|
|
||||||
Assert.IsTrue(parser.Arguments.ElementAt(0).Option.IsSet);
|
Assert.IsTrue(parser.Arguments.ElementAt(0).Option.IsSet);
|
||||||
Assert.IsNull(parser.Arguments.ElementAt(0).Option.Value);
|
Assert.IsNull(parser.Arguments.ElementAt(0).Option.Value);
|
||||||
Assert.AreEqual(0, parser.Arguments.ElementAt(0).Values.Length);
|
Assert.IsEmpty(parser.Arguments.ElementAt(0).Values);
|
||||||
|
|
||||||
Assert.IsTrue(parser.Arguments.ElementAt(1).Option.IsSet);
|
Assert.IsTrue(parser.Arguments.ElementAt(1).Option.IsSet);
|
||||||
Assert.AreEqual("two", parser.Arguments.ElementAt(1).Option.Value);
|
Assert.AreEqual("two", parser.Arguments.ElementAt(1).Option.Value);
|
||||||
Assert.AreEqual(1, parser.Arguments.ElementAt(1).Values.Length);
|
Assert.HasCount(1, parser.Arguments.ElementAt(1).Values);
|
||||||
Assert.AreEqual("two", parser.Arguments.ElementAt(1).Values.First());
|
Assert.AreEqual("two", parser.Arguments.ElementAt(1).Values.First());
|
||||||
|
|
||||||
Assert.IsTrue(parser.Arguments.ElementAt(2).Option.IsSet);
|
Assert.IsTrue(parser.Arguments.ElementAt(2).Option.IsSet);
|
||||||
Assert.AreEqual("three1", parser.Arguments.ElementAt(2).Option.Value);
|
Assert.AreEqual("three1", parser.Arguments.ElementAt(2).Option.Value);
|
||||||
Assert.AreEqual(2, parser.Arguments.ElementAt(2).Values.Length);
|
Assert.HasCount(2, parser.Arguments.ElementAt(2).Values);
|
||||||
Assert.AreEqual("three1", parser.Arguments.ElementAt(2).Values.First());
|
Assert.AreEqual("three1", parser.Arguments.ElementAt(2).Values.First());
|
||||||
Assert.AreEqual("three2", parser.Arguments.ElementAt(2).Values.Last());
|
Assert.AreEqual("three2", parser.Arguments.ElementAt(2).Values.Last());
|
||||||
|
|
||||||
Assert.IsTrue(parser.Arguments.ElementAt(3).Option.IsSet);
|
Assert.IsTrue(parser.Arguments.ElementAt(3).Option.IsSet);
|
||||||
Assert.AreEqual("four", parser.Arguments.ElementAt(3).Option.Value);
|
Assert.AreEqual("four", parser.Arguments.ElementAt(3).Option.Value);
|
||||||
Assert.AreEqual(1, parser.Arguments.ElementAt(3).Values.Length);
|
Assert.HasCount(1, parser.Arguments.ElementAt(3).Values);
|
||||||
Assert.AreEqual("four", parser.Arguments.ElementAt(3).Values.First());
|
Assert.AreEqual("four", parser.Arguments.ElementAt(3).Values.First());
|
||||||
|
|
||||||
Assert.IsTrue(parser.Arguments.ElementAt(4).Option.IsSet);
|
Assert.IsTrue(parser.Arguments.ElementAt(4).Option.IsSet);
|
||||||
Assert.AreEqual("testing", parser.Arguments.ElementAt(4).Option.Names.First());
|
Assert.AreEqual("testing", parser.Arguments.ElementAt(4).Option.Names.First());
|
||||||
Assert.AreEqual("done", parser.Arguments.ElementAt(4).Option.Value);
|
Assert.AreEqual("done", parser.Arguments.ElementAt(4).Option.Value);
|
||||||
Assert.AreEqual(1, parser.Arguments.ElementAt(4).Values.Length);
|
Assert.HasCount(1, parser.Arguments.ElementAt(4).Values);
|
||||||
Assert.AreEqual("done", parser.Arguments.ElementAt(4).Values.First());
|
Assert.AreEqual("done", parser.Arguments.ElementAt(4).Values.First());
|
||||||
|
|
||||||
Assert.IsNull(parser.Arguments.ElementAt(5).Option);
|
Assert.IsNull(parser.Arguments.ElementAt(5).Option);
|
||||||
Assert.AreEqual("foo", parser.Arguments.ElementAt(5).Value);
|
Assert.AreEqual("foo", parser.Arguments.ElementAt(5).Value);
|
||||||
Assert.AreEqual(1, parser.Arguments.ElementAt(5).Values.Length);
|
Assert.HasCount(1, parser.Arguments.ElementAt(5).Values);
|
||||||
|
|
||||||
Assert.IsNull(parser.Arguments.ElementAt(6).Option);
|
Assert.IsNull(parser.Arguments.ElementAt(6).Option);
|
||||||
Assert.AreEqual("bar", parser.Arguments.ElementAt(6).Value);
|
Assert.AreEqual("bar", parser.Arguments.ElementAt(6).Value);
|
||||||
Assert.AreEqual(1, parser.Arguments.ElementAt(6).Values.Length);
|
Assert.HasCount(1, parser.Arguments.ElementAt(6).Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -193,28 +193,23 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
var opts = parser.SetOptions;
|
var opts = parser.SetOptions;
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(2, opts.Length);
|
Assert.HasCount(2, opts);
|
||||||
|
|
||||||
Assert.AreEqual("opt1", opts.First().Names.First());
|
Assert.AreEqual("opt1", opts.First().Names.First());
|
||||||
Assert.AreEqual("opt3", opts.Last().Names.First());
|
Assert.AreEqual("opt3", opts.Last().Names.First());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
|
||||||
public void ShouldThrowExceptionOnNullArgs()
|
public void ShouldThrowExceptionOnNullArgs()
|
||||||
{
|
{
|
||||||
string[] args = null;
|
string[] args = null;
|
||||||
var parser = new CommandLineParser();
|
var parser = new CommandLineParser();
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
parser.Parse(args);
|
Assert.ThrowsExactly<ArgumentNullException>(() => parser.Parse(args));
|
||||||
|
|
||||||
// assert - ArgumentNullException
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(Exception))]
|
|
||||||
public void ShouldThrowExceptionOnMultipleAutocomplete()
|
public void ShouldThrowExceptionOnMultipleAutocomplete()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
@@ -226,15 +221,11 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
parser.RegisterOption("Option1", 1);
|
parser.RegisterOption("Option1", 1);
|
||||||
parser.RegisterOption("Option2", 1);
|
parser.RegisterOption("Option2", 1);
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
parser.Parse(args);
|
Assert.ThrowsExactly<Exception>(() => parser.Parse(args));
|
||||||
|
|
||||||
// assert - Exception
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(Exception))]
|
|
||||||
public void ShouldThrowExceptionOnMissingOption()
|
public void ShouldThrowExceptionOnMissingOption()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
@@ -246,15 +237,11 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
parser.RegisterOption("Opt1", 1);
|
parser.RegisterOption("Opt1", 1);
|
||||||
parser.RegisterOption("Opt2", 1);
|
parser.RegisterOption("Opt2", 1);
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
parser.Parse(args);
|
Assert.ThrowsExactly<Exception>(() => parser.Parse(args));
|
||||||
|
|
||||||
// assert - Exception
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(Exception))]
|
|
||||||
public void ShouldTrhowExceptionOnDuplicateOption()
|
public void ShouldTrhowExceptionOnDuplicateOption()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
@@ -262,15 +249,11 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
var parser = new CommandLineParser();
|
var parser = new CommandLineParser();
|
||||||
parser.RegisterOption("opt", 1).Single();
|
parser.RegisterOption("opt", 1).Single();
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
parser.Parse(args);
|
Assert.ThrowsExactly<Exception>(() => parser.Parse(args));
|
||||||
|
|
||||||
// assert - Exception
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(Exception))]
|
|
||||||
public void ShouldThrowExceptionOnMissingArgument()
|
public void ShouldThrowExceptionOnMissingArgument()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
@@ -278,15 +261,11 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
var parser = new CommandLineParser();
|
var parser = new CommandLineParser();
|
||||||
parser.RegisterOption("option", 1);
|
parser.RegisterOption("option", 1);
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
parser.Parse(args);
|
Assert.ThrowsExactly<Exception>(() => parser.Parse(args));
|
||||||
|
|
||||||
// assert - Exception
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(Exception))]
|
|
||||||
public void ShouldThrowExceptionForMissingRequiredOption()
|
public void ShouldThrowExceptionForMissingRequiredOption()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
@@ -295,11 +274,8 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
parser.RegisterOption("opt").Required();
|
parser.RegisterOption("opt").Required();
|
||||||
parser.RegisterOption("foo").Required();
|
parser.RegisterOption("foo").Required();
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
parser.Parse(args);
|
Assert.ThrowsExactly<Exception>(() => parser.Parse(args));
|
||||||
|
|
||||||
// assert - Exception
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,12 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
|
||||||
public void ShouldThrowExceptionOnNullReference()
|
public void ShouldThrowExceptionOnNullReference()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
_ = new EnumerableWalker<object>(null);
|
Assert.ThrowsExactly<ArgumentNullException>(() => new EnumerableWalker<string>(null));
|
||||||
|
|
||||||
// assert - ArgumentNullException
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -76,7 +72,7 @@ namespace AMWD.Common.Tests.Cli
|
|||||||
public void ShouldReturnDefaultWhenNothingLeft()
|
public void ShouldReturnDefaultWhenNothingLeft()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var walker = new EnumerableWalker<string>(Array.Empty<string>());
|
var walker = new EnumerableWalker<string>([]);
|
||||||
_ = walker.GetEnumerator();
|
_ = walker.GetEnumerator();
|
||||||
|
|
||||||
// act
|
// act
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class DomainComparerTest
|
public class DomainComparerTest
|
||||||
{
|
{
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("int", "internal")]
|
[DataRow("int", "internal")]
|
||||||
[DataRow("int", "dom.int")]
|
[DataRow("int", "dom.int")]
|
||||||
[DataRow("a.ins", "a.int")]
|
[DataRow("a.ins", "a.int")]
|
||||||
@@ -22,7 +22,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
Assert.AreEqual(-1, result);
|
Assert.AreEqual(-1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("internal", "int")]
|
[DataRow("internal", "int")]
|
||||||
[DataRow("dom.int", "int")]
|
[DataRow("dom.int", "int")]
|
||||||
[DataRow("a.int", "a.ins")]
|
[DataRow("a.int", "a.ins")]
|
||||||
@@ -39,7 +39,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
Assert.AreEqual(1, result);
|
Assert.AreEqual(1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("internal", "internal")]
|
[DataRow("internal", "internal")]
|
||||||
[DataRow("dom.int", "dom.int")]
|
[DataRow("dom.int", "dom.int")]
|
||||||
[DataRow("a.internal", "a.internal")]
|
[DataRow("a.internal", "a.internal")]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class IPAddressComparerTest
|
public class IPAddressComparerTest
|
||||||
{
|
{
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("127.0.0.0", "127.0.0.1")]
|
[DataRow("127.0.0.0", "127.0.0.1")]
|
||||||
[DataRow("fe80::", "fe80::1")]
|
[DataRow("fe80::", "fe80::1")]
|
||||||
[DataRow("::ffff:7f00:0", "127.0.0.1")]
|
[DataRow("::ffff:7f00:0", "127.0.0.1")]
|
||||||
@@ -22,7 +22,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
Assert.AreEqual(-1, result);
|
Assert.AreEqual(-1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("127.0.0.1", "127.0.0.0")]
|
[DataRow("127.0.0.1", "127.0.0.0")]
|
||||||
[DataRow("fe80::1", "fe80::")]
|
[DataRow("fe80::1", "fe80::")]
|
||||||
[DataRow("::ffff:7f00:1", "127.0.0.0")]
|
[DataRow("::ffff:7f00:1", "127.0.0.0")]
|
||||||
@@ -38,7 +38,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
Assert.AreEqual(1, result);
|
Assert.AreEqual(1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("127.0.0.1", "127.0.0.1")]
|
[DataRow("127.0.0.1", "127.0.0.1")]
|
||||||
[DataRow("fe80::1", "fe80::1")]
|
[DataRow("fe80::1", "fe80::1")]
|
||||||
[DataRow("::ffff:7f00:1", "127.0.0.1")]
|
[DataRow("::ffff:7f00:1", "127.0.0.1")]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class VersionStringComparerTest
|
public class VersionStringComparerTest
|
||||||
{
|
{
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow(null, "0")]
|
[DataRow(null, "0")]
|
||||||
[DataRow("", "0")]
|
[DataRow("", "0")]
|
||||||
[DataRow("0", "1")]
|
[DataRow("0", "1")]
|
||||||
@@ -25,7 +25,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
Assert.AreEqual(-1, result);
|
Assert.AreEqual(-1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("0", null)]
|
[DataRow("0", null)]
|
||||||
[DataRow("0", "")]
|
[DataRow("0", "")]
|
||||||
[DataRow("1", "0")]
|
[DataRow("1", "0")]
|
||||||
@@ -45,7 +45,7 @@ namespace AMWD.Common.Tests.Comparer
|
|||||||
Assert.AreEqual(1, result);
|
Assert.AreEqual(1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow(null, null)]
|
[DataRow(null, null)]
|
||||||
[DataRow("", "")]
|
[DataRow("", "")]
|
||||||
[DataRow("1", "1")]
|
[DataRow("1", "1")]
|
||||||
|
|||||||
@@ -11,19 +11,19 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var item = new TestItem { Number = 10, Text = "Ten" };
|
var item = new TestItem { Number = 10, Text = "Ten" };
|
||||||
ICollection<TestItem> list = new List<TestItem>
|
ICollection<TestItem> list =
|
||||||
{
|
[
|
||||||
new() {
|
new() {
|
||||||
Number = 1,
|
Number = 1,
|
||||||
Text = "One"
|
Text = "One"
|
||||||
}
|
}
|
||||||
};
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
list.AddIfNotNull(item);
|
list.AddIfNotNull(item);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(2, list.Count);
|
Assert.HasCount(2, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -31,105 +31,95 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
TestItem item = null;
|
TestItem item = null;
|
||||||
ICollection<TestItem> list = new List<TestItem>
|
ICollection<TestItem> list =
|
||||||
{
|
[
|
||||||
new() {
|
new() {
|
||||||
Number = 1,
|
Number = 1,
|
||||||
Text = "One"
|
Text = "One"
|
||||||
}
|
}
|
||||||
};
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
list.AddIfNotNull(item);
|
list.AddIfNotNull(item);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, list.Count);
|
Assert.HasCount(1, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
|
||||||
public void ShouldThrowArgumentNullExceptionForNullList()
|
public void ShouldThrowArgumentNullExceptionForNullList()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var item = new TestItem { Number = 10, Text = "Ten" };
|
var item = new TestItem { Number = 10, Text = "Ten" };
|
||||||
ICollection<TestItem> list = null;
|
ICollection<TestItem> list = null;
|
||||||
|
|
||||||
// Act
|
// Act & Assert
|
||||||
list.AddIfNotNull(item);
|
Assert.ThrowsExactly<ArgumentNullException>(() => list.AddIfNotNull(item));
|
||||||
|
|
||||||
// Assert - ArgumentNullException
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ShouldAddRange()
|
public void ShouldAddRange()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
ICollection<TestItem> items = new List<TestItem>
|
ICollection<TestItem> items =
|
||||||
{
|
[
|
||||||
new() { Number = 10, Text = "Ten" },
|
new() { Number = 10, Text = "Ten" },
|
||||||
new() { Number = 11, Text = "Eleven" },
|
new() { Number = 11, Text = "Eleven" },
|
||||||
};
|
];
|
||||||
ICollection<TestItem> list = new List<TestItem>
|
ICollection<TestItem> list =
|
||||||
{
|
[
|
||||||
new() { Number = 1, Text = "One" },
|
new() { Number = 1, Text = "One" },
|
||||||
};
|
// Act
|
||||||
|
.. items,
|
||||||
// Act
|
];
|
||||||
list.AddRange(items);
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(3, list.Count);
|
Assert.HasCount(3, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
|
||||||
public void ShouldThrowArgumentNullExceptionForList()
|
public void ShouldThrowArgumentNullExceptionForList()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
ICollection<TestItem> items = new List<TestItem>
|
ICollection<TestItem> items =
|
||||||
{
|
[
|
||||||
new() { Number = 10, Text = "Ten" },
|
new() { Number = 10, Text = "Ten" },
|
||||||
new() { Number = 11, Text = "Eleven" },
|
new() { Number = 11, Text = "Eleven" },
|
||||||
};
|
];
|
||||||
ICollection<TestItem> list = null;
|
ICollection<TestItem> list = null;
|
||||||
|
|
||||||
// Act
|
// Act & Assert
|
||||||
list.AddRange(items);
|
Assert.ThrowsExactly<ArgumentNullException>(() => list.AddRange(items));
|
||||||
|
|
||||||
// Assert - ArgumentNullException
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
|
||||||
public void ShouldThrowArgumentNullExceptionForItems()
|
public void ShouldThrowArgumentNullExceptionForItems()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
ICollection<TestItem> items = null;
|
ICollection<TestItem> items = null;
|
||||||
ICollection<TestItem> list = new List<TestItem>
|
ICollection<TestItem> list =
|
||||||
{
|
[
|
||||||
new() { Number = 1, Text = "One" },
|
new() { Number = 1, Text = "One" },
|
||||||
};
|
];
|
||||||
|
|
||||||
// Act
|
// Act & Assert
|
||||||
list.AddRange(items);
|
Assert.ThrowsExactly<ArgumentNullException>(() => list.AddRange(items));
|
||||||
|
|
||||||
// Assert - ArgumentNullException
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ShouldNotAddRange()
|
public void ShouldNotAddRange()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
ICollection<TestItem> list = new List<TestItem>
|
ICollection<TestItem> list =
|
||||||
{
|
[
|
||||||
new() { Number = 1, Text = "One" },
|
new() { Number = 1, Text = "One" },
|
||||||
};
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
list.AddRange(list);
|
list.AddRange(list);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, list.Count);
|
Assert.HasCount(1, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestItem
|
private class TestItem
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class ReaderWriterLockSlimExtensionsTest
|
public class ReaderWriterLockSlimExtensionsTest
|
||||||
{
|
{
|
||||||
|
public TestContext TestContext { get; set; }
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ShouldEnterReadLock()
|
public void ShouldEnterReadLock()
|
||||||
{
|
{
|
||||||
@@ -151,8 +153,8 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ /* keep it quiet */ }
|
{ /* keep it quiet */ }
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
awaitableTask.Wait();
|
awaitableTask.Wait(TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsTrue(isTimeout);
|
Assert.IsTrue(isTimeout);
|
||||||
@@ -180,8 +182,8 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ /* keep it quiet */ }
|
{ /* keep it quiet */ }
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
awaitableTask.Wait();
|
awaitableTask.Wait(TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsTrue(isTimeout);
|
Assert.IsTrue(isTimeout);
|
||||||
@@ -209,8 +211,8 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ /* keep it quiet */ }
|
{ /* keep it quiet */ }
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
awaitableTask.Wait();
|
awaitableTask.Wait(TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsTrue(isTimeout);
|
Assert.IsTrue(isTimeout);
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class StreamExtensionsTest
|
public class StreamExtensionsTest
|
||||||
{
|
{
|
||||||
|
public TestContext TestContext { get; set; }
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ShouldReadLineFromStreamSynchronous()
|
public void ShouldReadLineFromStreamSynchronous()
|
||||||
{
|
{
|
||||||
@@ -69,7 +71,7 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
var stream = new MemoryStream(buffer);
|
var stream = new MemoryStream(buffer);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
string line = await stream.ReadLineAsync();
|
string line = await stream.ReadLineAsync(cancellationToken: TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual("First Line", line);
|
Assert.AreEqual("First Line", line);
|
||||||
@@ -85,7 +87,7 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
var stream = new MemoryStream(buffer);
|
var stream = new MemoryStream(buffer);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
string line = await stream.ReadLineAsync();
|
string line = await stream.ReadLineAsync(cancellationToken: TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual("Single Line", line);
|
Assert.AreEqual("Single Line", line);
|
||||||
@@ -100,7 +102,7 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
var stream = new WriteOnlyStream();
|
var stream = new WriteOnlyStream();
|
||||||
|
|
||||||
// act
|
// act
|
||||||
string line = await stream.ReadLineAsync();
|
string line = await stream.ReadLineAsync(cancellationToken: TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNull(line);
|
Assert.IsNull(line);
|
||||||
|
|||||||
@@ -9,16 +9,13 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
public class StringExtensionsTest
|
public class StringExtensionsTest
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentNullException))]
|
|
||||||
public void ShouldThrowArgumentNullExceptionWhenNull()
|
public void ShouldThrowArgumentNullExceptionWhenNull()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
string hex = null;
|
string hex = null;
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
var bytes = hex.HexToBytes();
|
Assert.ThrowsExactly<ArgumentNullException>(() => hex.HexToBytes());
|
||||||
|
|
||||||
// assert - ArgumentNullException
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -35,19 +32,16 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
Assert.IsFalse(bytes.Any());
|
Assert.IsFalse(bytes.Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow("aff", null)]
|
[DataRow("aff", null)]
|
||||||
[DataRow("de:ad:be:e", ":")]
|
[DataRow("de:ad:be:e", ":")]
|
||||||
[DataRow("hell", "")]
|
[DataRow("hell", "")]
|
||||||
[ExpectedException(typeof(FormatException))]
|
|
||||||
public void ShouldThrowFormatExceptionWhenInvalid(string hex, string delimiter)
|
public void ShouldThrowFormatExceptionWhenInvalid(string hex, string delimiter)
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
var bytes = hex.HexToBytes(delimiter);
|
Assert.ThrowsExactly<FormatException>(() => hex.HexToBytes(delimiter));
|
||||||
|
|
||||||
// assert - FormatException
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -308,8 +302,8 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
var nameserver = new IPEndPoint(IPAddress.Parse("1.1.1.1"), 53);
|
var nameserver = new IPEndPoint(IPAddress.Parse("1.1.1.1"), 53);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
bool valid = validEmail.IsValidEmailAddress(new[] { nameserver });
|
bool valid = validEmail.IsValidEmailAddress([nameserver]);
|
||||||
bool invalid = !invalidEmail.IsValidEmailAddress(new[] { nameserver });
|
bool invalid = !invalidEmail.IsValidEmailAddress([nameserver]);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsTrue(valid);
|
Assert.IsTrue(valid);
|
||||||
@@ -349,7 +343,7 @@ namespace AMWD.Common.Tests.Extensions
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual($"{value}\r{value}\r", sb.ToString());
|
Assert.AreEqual($"{value}\r{value}\r", sb.ToString());
|
||||||
Assert.IsFalse(sb.ToString().Contains('\n'));
|
Assert.DoesNotContain('\n', sb.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,51 +83,39 @@ namespace AMWD.Common.Tests.Logging
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ObjectDisposedException))]
|
|
||||||
public void ShouldThrowDisposedOnIsEnabled()
|
public void ShouldThrowDisposedOnIsEnabled()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var logger = GetFileLogger();
|
var logger = GetFileLogger();
|
||||||
|
|
||||||
// act
|
|
||||||
logger.Dispose();
|
logger.Dispose();
|
||||||
logger.IsEnabled(LogLevel.Error);
|
|
||||||
|
|
||||||
// assert - ObjectDisposedException
|
// act & assert
|
||||||
Assert.Fail();
|
Assert.ThrowsExactly<ObjectDisposedException>(() => logger.IsEnabled(LogLevel.Error));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ObjectDisposedException))]
|
|
||||||
public void ShouldThrowDisposedOnLog()
|
public void ShouldThrowDisposedOnLog()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var logger = GetFileLogger();
|
var logger = GetFileLogger();
|
||||||
|
|
||||||
// act
|
|
||||||
logger.Dispose();
|
logger.Dispose();
|
||||||
logger.Log(LogLevel.None, "Some Message");
|
|
||||||
|
|
||||||
// assert - ObjectDisposedException
|
// act & assert
|
||||||
Assert.Fail();
|
Assert.ThrowsExactly<ObjectDisposedException>(() => logger.Log(LogLevel.None, "Some Message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ObjectDisposedException))]
|
|
||||||
public void ShouldThrowDisposedOnBeginScope()
|
public void ShouldThrowDisposedOnBeginScope()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var logger = GetFileLogger();
|
var logger = GetFileLogger();
|
||||||
|
|
||||||
// act
|
|
||||||
logger.Dispose();
|
logger.Dispose();
|
||||||
logger.BeginScope("foo");
|
|
||||||
|
|
||||||
// assert - ObjectDisposedException
|
// act & assert
|
||||||
Assert.Fail();
|
Assert.ThrowsExactly<ObjectDisposedException>(() => logger.BeginScope("foo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[TestMethod]
|
||||||
[DataRow(LogLevel.Trace, false)]
|
[DataRow(LogLevel.Trace, false)]
|
||||||
[DataRow(LogLevel.Debug, false)]
|
[DataRow(LogLevel.Debug, false)]
|
||||||
[DataRow(LogLevel.Information, false)]
|
[DataRow(LogLevel.Information, false)]
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class AsyncQueueTest
|
public class AsyncQueueTest
|
||||||
{
|
{
|
||||||
|
public TestContext TestContext { get; set; }
|
||||||
|
|
||||||
private Queue<TestElement> _internalQueue;
|
private Queue<TestElement> _internalQueue;
|
||||||
|
|
||||||
private TestElement _queueElement1;
|
private TestElement _queueElement1;
|
||||||
@@ -52,7 +54,7 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
queue.Enqueue(element);
|
queue.Enqueue(element);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(1, _internalQueue.Count);
|
Assert.HasCount(1, _internalQueue);
|
||||||
Assert.AreEqual(_internalQueue.Count, queue.Count);
|
Assert.AreEqual(_internalQueue.Count, queue.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,11 +71,11 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
// act
|
// act
|
||||||
var task = Task.Run(async () =>
|
var task = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await queue.WaitAsync();
|
await queue.WaitAsync(TestContext.CancellationToken);
|
||||||
available = true;
|
available = true;
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
queue.Enqueue(element);
|
queue.Enqueue(element);
|
||||||
task.Wait();
|
task.Wait(TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsTrue(available);
|
Assert.IsTrue(available);
|
||||||
@@ -92,10 +94,10 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
// act
|
// act
|
||||||
var task = Task.Run(async () =>
|
var task = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
callback = await queue.DequeueAsync();
|
callback = await queue.DequeueAsync(TestContext.CancellationToken);
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
queue.Enqueue(element);
|
queue.Enqueue(element);
|
||||||
task.Wait();
|
task.Wait(TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNotNull(callback);
|
Assert.IsNotNull(callback);
|
||||||
@@ -118,8 +120,8 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
queue.Enqueue(elements);
|
queue.Enqueue(elements);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(2, _internalQueue.Count);
|
Assert.HasCount(2, _internalQueue);
|
||||||
Assert.AreEqual(queue.Count, _internalQueue.Count);
|
Assert.HasCount(queue.Count, _internalQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -229,12 +231,12 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
|
|
||||||
var task = Task.Run(async () =>
|
var task = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000, TestContext.CancellationToken);
|
||||||
queue.Enqueue(new[] { _queueElement1, _queueElement2, _queueElement3 });
|
queue.Enqueue([_queueElement1, _queueElement2, _queueElement3]);
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var item = await queue.DequeueAsync();
|
var item = await queue.DequeueAsync(TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(2, queue.Count);
|
Assert.AreEqual(2, queue.Count);
|
||||||
@@ -251,17 +253,17 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
|
|
||||||
var task = Task.Run(async () =>
|
var task = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000, TestContext.CancellationToken);
|
||||||
queue.Enqueue(new[] { _queueElement1, _queueElement2, _queueElement3 });
|
queue.Enqueue([_queueElement1, _queueElement2, _queueElement3]);
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var items = await queue.DequeueManyAsync(2);
|
var items = await queue.DequeueManyAsync(2, TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(1, queue.Count);
|
Assert.AreEqual(1, queue.Count);
|
||||||
Assert.IsNotNull(items);
|
Assert.IsNotNull(items);
|
||||||
Assert.AreEqual(2, items.Length);
|
Assert.HasCount(2, items);
|
||||||
Assert.AreEqual(_queueElement1, items[0]);
|
Assert.AreEqual(_queueElement1, items[0]);
|
||||||
Assert.AreEqual(_queueElement2, items[1]);
|
Assert.AreEqual(_queueElement2, items[1]);
|
||||||
}
|
}
|
||||||
@@ -275,17 +277,17 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
|
|
||||||
var task = Task.Run(async () =>
|
var task = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000, TestContext.CancellationToken);
|
||||||
queue.Enqueue(new[] { _queueElement1, _queueElement2, _queueElement3 });
|
queue.Enqueue([_queueElement1, _queueElement2, _queueElement3]);
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var items = await queue.DequeueAvailableAsync();
|
var items = await queue.DequeueAvailableAsync(cancellationToken: TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(0, queue.Count);
|
Assert.AreEqual(0, queue.Count);
|
||||||
Assert.IsNotNull(items);
|
Assert.IsNotNull(items);
|
||||||
Assert.AreEqual(3, items.Length);
|
Assert.HasCount(3, items);
|
||||||
Assert.AreEqual(_queueElement1, items[0]);
|
Assert.AreEqual(_queueElement1, items[0]);
|
||||||
Assert.AreEqual(_queueElement2, items[1]);
|
Assert.AreEqual(_queueElement2, items[1]);
|
||||||
Assert.AreEqual(_queueElement3, items[2]);
|
Assert.AreEqual(_queueElement3, items[2]);
|
||||||
@@ -300,34 +302,30 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
|
|
||||||
var task = Task.Run(async () =>
|
var task = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000, TestContext.CancellationToken);
|
||||||
queue.Enqueue(new[] { _queueElement1, _queueElement2, _queueElement3 });
|
queue.Enqueue([_queueElement1, _queueElement2, _queueElement3]);
|
||||||
});
|
}, TestContext.CancellationToken);
|
||||||
|
|
||||||
// act
|
// act
|
||||||
var items = await queue.DequeueAvailableAsync(2);
|
var items = await queue.DequeueAvailableAsync(2, TestContext.CancellationToken);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(1, queue.Count);
|
Assert.AreEqual(1, queue.Count);
|
||||||
Assert.IsNotNull(items);
|
Assert.IsNotNull(items);
|
||||||
Assert.AreEqual(2, items.Length);
|
Assert.HasCount(2, items);
|
||||||
Assert.AreEqual(_queueElement1, items[0]);
|
Assert.AreEqual(_queueElement1, items[0]);
|
||||||
Assert.AreEqual(_queueElement2, items[1]);
|
Assert.AreEqual(_queueElement2, items[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
|
||||||
public async Task ShouldThrowArumentOutOfRangeException()
|
public async Task ShouldThrowArumentOutOfRangeException()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
_internalQueue.Clear();
|
_internalQueue.Clear();
|
||||||
var queue = GetQueue();
|
var queue = GetQueue();
|
||||||
|
|
||||||
// act
|
// act & assert
|
||||||
await queue.DequeueManyAsync(-2);
|
await Assert.ThrowsExactlyAsync<ArgumentOutOfRangeException>(() => queue.DequeueManyAsync(-2, TestContext.CancellationToken));
|
||||||
|
|
||||||
// assert - ArgumentOutOfRangeException expected
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private AsyncQueue<TestElement> GetQueue()
|
private AsyncQueue<TestElement> GetQueue()
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ namespace UnitTests.Common.Utilities
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
CollectionAssert.AreNotEqual(cipher1, cipher2);
|
CollectionAssert.AreNotEqual(cipher1, cipher2);
|
||||||
Assert.AreEqual(24, cipher1.Length);
|
Assert.HasCount(24, cipher1);
|
||||||
Assert.AreEqual(24, cipher2.Length);
|
Assert.HasCount(24, cipher2);
|
||||||
CollectionAssert.AreEqual(plain, plain1);
|
CollectionAssert.AreEqual(plain, plain1);
|
||||||
CollectionAssert.AreEqual(plain, plain2);
|
CollectionAssert.AreEqual(plain, plain2);
|
||||||
}
|
}
|
||||||
@@ -228,8 +228,8 @@ namespace UnitTests.Common.Utilities
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
CollectionAssert.AreNotEqual(cipher1, cipher2);
|
CollectionAssert.AreNotEqual(cipher1, cipher2);
|
||||||
Assert.AreEqual(16, cipher1.Length);
|
Assert.HasCount(16, cipher1);
|
||||||
Assert.AreEqual(16, cipher2.Length);
|
Assert.HasCount(16, cipher2);
|
||||||
CollectionAssert.AreEqual(plain, plain1);
|
CollectionAssert.AreEqual(plain, plain1);
|
||||||
CollectionAssert.AreEqual(plain, plain2);
|
CollectionAssert.AreEqual(plain, plain2);
|
||||||
}
|
}
|
||||||
@@ -368,11 +368,11 @@ namespace UnitTests.Common.Utilities
|
|||||||
byte[] bytes3 = CryptographyHelper.GetRandomBytes(length3);
|
byte[] bytes3 = CryptographyHelper.GetRandomBytes(length3);
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(length1, bytes1.Length);
|
Assert.HasCount(length1, bytes1);
|
||||||
Assert.AreEqual(length2, bytes2.Length);
|
Assert.HasCount(length2, bytes2);
|
||||||
Assert.AreEqual(length3, bytes3.Length);
|
Assert.HasCount(length3, bytes3);
|
||||||
|
|
||||||
Assert.IsTrue(bytes1.Length == bytes2.Length);
|
Assert.HasCount(bytes2.Length, bytes1);
|
||||||
CollectionAssert.AreNotEqual(bytes1, bytes2);
|
CollectionAssert.AreNotEqual(bytes1, bytes2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,8 +394,8 @@ namespace UnitTests.Common.Utilities
|
|||||||
Assert.AreEqual(length2, str2.Length);
|
Assert.AreEqual(length2, str2.Length);
|
||||||
Assert.AreEqual(length3, str3.Length);
|
Assert.AreEqual(length3, str3.Length);
|
||||||
|
|
||||||
Assert.IsTrue(str1.Length == str2.Length);
|
Assert.HasCount(str2.Length, str2);
|
||||||
Assert.IsFalse(str1 == str2);
|
Assert.AreNotEqual(str2, str1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -412,7 +412,7 @@ namespace UnitTests.Common.Utilities
|
|||||||
// assert
|
// assert
|
||||||
Assert.AreEqual(length, str1.Length);
|
Assert.AreEqual(length, str1.Length);
|
||||||
Assert.AreEqual(length, str2.Length);
|
Assert.AreEqual(length, str2.Length);
|
||||||
Assert.IsFalse(str1 == str2);
|
Assert.AreNotEqual(str2, str1);
|
||||||
Assert.IsFalse(RandomStringWithPoolRegex().IsMatch(str1));
|
Assert.IsFalse(RandomStringWithPoolRegex().IsMatch(str1));
|
||||||
Assert.IsFalse(RandomStringWithPoolRegex().IsMatch(str2));
|
Assert.IsFalse(RandomStringWithPoolRegex().IsMatch(str2));
|
||||||
}
|
}
|
||||||
@@ -532,7 +532,7 @@ namespace UnitTests.Common.Utilities
|
|||||||
Assert.IsFalse(fileExistsBefore);
|
Assert.IsFalse(fileExistsBefore);
|
||||||
Assert.IsNotNull(helper);
|
Assert.IsNotNull(helper);
|
||||||
Assert.IsTrue(fileExistsAfter);
|
Assert.IsTrue(fileExistsAfter);
|
||||||
Assert.IsTrue(!string.IsNullOrWhiteSpace(content));
|
Assert.IsFalse(string.IsNullOrWhiteSpace(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class DelayedTaskTest
|
public class DelayedTaskTest
|
||||||
{
|
{
|
||||||
|
public TestContext TestContext { get; set; }
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ShouldCreateNewDelayedTaskNotStarting()
|
public void ShouldCreateNewDelayedTaskNotStarting()
|
||||||
{
|
{
|
||||||
@@ -113,7 +115,7 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
var cts = new CancellationTokenSource(delay.Add(TimeSpan.FromSeconds(1)));
|
var cts = new CancellationTokenSource(delay.Add(TimeSpan.FromSeconds(1)));
|
||||||
sw.Start();
|
sw.Start();
|
||||||
var delayedTask = DelayedTask.Run(Action, delay);
|
var delayedTask = DelayedTask.Run(Action, delay);
|
||||||
await Task.Delay(50);
|
await Task.Delay(50, TestContext.CancellationToken);
|
||||||
delayedTask.Reset();
|
delayedTask.Reset();
|
||||||
SpinWait.SpinUntil(() => executionCount > 0 || cts.IsCancellationRequested);
|
SpinWait.SpinUntil(() => executionCount > 0 || cts.IsCancellationRequested);
|
||||||
|
|
||||||
@@ -142,7 +144,7 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
var cts = new CancellationTokenSource(delay.Add(TimeSpan.FromSeconds(1)));
|
var cts = new CancellationTokenSource(delay.Add(TimeSpan.FromSeconds(1)));
|
||||||
sw.Start();
|
sw.Start();
|
||||||
var delayedTask = DelayedTask.Create(Action, delay);
|
var delayedTask = DelayedTask.Create(Action, delay);
|
||||||
await Task.Delay(50);
|
await Task.Delay(50, TestContext.CancellationToken);
|
||||||
bool isSuccess = delayedTask.ExecutePending();
|
bool isSuccess = delayedTask.ExecutePending();
|
||||||
SpinWait.SpinUntil(() => executionCount > 0 || cts.IsCancellationRequested);
|
SpinWait.SpinUntil(() => executionCount > 0 || cts.IsCancellationRequested);
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
@@ -173,7 +175,7 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
var cts = new CancellationTokenSource(delay.Add(TimeSpan.FromSeconds(1)));
|
var cts = new CancellationTokenSource(delay.Add(TimeSpan.FromSeconds(1)));
|
||||||
sw.Start();
|
sw.Start();
|
||||||
var delayedTask = DelayedTask.Run(Action, delay);
|
var delayedTask = DelayedTask.Run(Action, delay);
|
||||||
await Task.Delay(50);
|
await Task.Delay(50, TestContext.CancellationToken);
|
||||||
bool isSuccess = delayedTask.ExecutePending();
|
bool isSuccess = delayedTask.ExecutePending();
|
||||||
SpinWait.SpinUntil(() => executionCount > 0 || cts.IsCancellationRequested);
|
SpinWait.SpinUntil(() => executionCount > 0 || cts.IsCancellationRequested);
|
||||||
|
|
||||||
@@ -205,7 +207,6 @@ namespace AMWD.Common.Tests.Utilities
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
Assert.IsNotNull(delayedTask);
|
Assert.IsNotNull(delayedTask);
|
||||||
Assert.IsNotNull(awaiter);
|
|
||||||
Assert.IsFalse(delayedTask.IsRunning);
|
Assert.IsFalse(delayedTask.IsRunning);
|
||||||
Assert.IsFalse(delayedTask.IsWaitingToRun);
|
Assert.IsFalse(delayedTask.IsWaitingToRun);
|
||||||
Assert.IsNull(delayedTask.Exception);
|
Assert.IsNull(delayedTask.Exception);
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
|
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||||
<PackageReference Include="Moq" Version="4.20.70" />
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
|
<PackageReference Include="MSTest.TestAdapter" Version="4.0.2" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
|
<PackageReference Include="MSTest.TestFramework" Version="4.0.2" />
|
||||||
<PackageReference Include="ReflectionMagic" Version="5.0.1" />
|
<PackageReference Include="ReflectionMagic" Version="5.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
1
test/MSTestSettings.cs
Normal file
1
test/MSTestSettings.cs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[assembly: Parallelize(Scope = ExecutionScope.ClassLevel)]
|
||||||
Reference in New Issue
Block a user