NucuCar.Domain: Add tests for Guard class
This commit is contained in:
parent
25d85dc526
commit
8bd7283316
4 changed files with 42 additions and 3 deletions
|
@ -6,7 +6,6 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NucuCar.Common\NucuCar.Common.csproj" />
|
||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using NucuCar.Domain.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace NucuCar.UnitTests.NucuCar.Common.Tests
|
||||
namespace NucuCar.UnitTests.NucuCar.Domain.Tests
|
||||
{
|
||||
public class ConnectionStringParserTest
|
||||
{
|
||||
|
|
40
NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs
Normal file
40
NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using NucuCar.Domain.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace NucuCar.UnitTests.NucuCar.Domain.Tests
|
||||
{
|
||||
public class GuardTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensure that an exception is thrown when the argument is null or whitespace,
|
||||
/// and no exception is raised when the argument is non-null.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
private void Test_GuardArgumentNotNullOrWhitespace()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
Guard.ArgumentNotNullOrWhiteSpace("null", null);
|
||||
});
|
||||
Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
Guard.ArgumentNotNullOrWhiteSpace("whitespace", "");
|
||||
});
|
||||
Guard.ArgumentNotNullOrWhiteSpace("string", "string");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure that an exception is thrown when argument is null. Otherwise no exception should be thrown.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
private void Test_GuardArgumentNotNull()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
Guard.ArgumentNotNull("null", null);
|
||||
});
|
||||
Guard.ArgumentNotNull("object", new string("asd"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,6 @@
|
|||
</SessionState></s:String>
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=e8af539e_002D0b50_002D476d_002Daa84_002D80fbff5a748b/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="Test_PublishAsync_OK" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||
<TestAncestor>
|
||||
<TestId>xUnit::C6F07921-1052-4945-911E-F328A622F229::.NETCoreApp,Version=v3.1::NucuCar.UnitTests.NucuCar.Telemetry.Tests.TelemetryPublisherFirestoreTest.Test_PublishAsync_OK</TestId>
|
||||
<TestId>xUnit::C6F07921-1052-4945-911E-F328A622F229::.NETCoreApp,Version=v3.1::NucuCar.UnitTests.NucuCar.Domain.Tests.GuardTest</TestId>
|
||||
</TestAncestor>
|
||||
</SessionState></s:String></wpf:ResourceDictionary>
|
Loading…
Reference in a new issue