diff --git a/NucuCar.Domain.Telemetry/NucuCar.Domain.Telemetry.csproj b/NucuCar.Domain.Telemetry/NucuCar.Domain.Telemetry.csproj index 9347bd7..7f26de5 100644 --- a/NucuCar.Domain.Telemetry/NucuCar.Domain.Telemetry.csproj +++ b/NucuCar.Domain.Telemetry/NucuCar.Domain.Telemetry.csproj @@ -6,7 +6,6 @@ - diff --git a/NucuCar.UnitTests/NucuCar.Domain.Tests/ConnectionStringParserTest.cs b/NucuCar.UnitTests/NucuCar.Domain.Tests/ConnectionStringParserTest.cs index b4dde39..3e98814 100644 --- a/NucuCar.UnitTests/NucuCar.Domain.Tests/ConnectionStringParserTest.cs +++ b/NucuCar.UnitTests/NucuCar.Domain.Tests/ConnectionStringParserTest.cs @@ -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 { diff --git a/NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs b/NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs new file mode 100644 index 0000000..bc65ad2 --- /dev/null +++ b/NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs @@ -0,0 +1,40 @@ +using System; +using NucuCar.Domain.Utilities; +using Xunit; + +namespace NucuCar.UnitTests.NucuCar.Domain.Tests +{ + public class GuardTest + { + /// + /// Ensure that an exception is thrown when the argument is null or whitespace, + /// and no exception is raised when the argument is non-null. + /// + [Fact] + private void Test_GuardArgumentNotNullOrWhitespace() + { + Assert.Throws(() => + { + Guard.ArgumentNotNullOrWhiteSpace("null", null); + }); + Assert.Throws(() => + { + Guard.ArgumentNotNullOrWhiteSpace("whitespace", ""); + }); + Guard.ArgumentNotNullOrWhiteSpace("string", "string"); + } + + /// + /// Ensure that an exception is thrown when argument is null. Otherwise no exception should be thrown. + /// + [Fact] + private void Test_GuardArgumentNotNull() + { + Assert.Throws(() => + { + Guard.ArgumentNotNull("null", null); + }); + Guard.ArgumentNotNull("object", new string("asd")); + } + } +} \ No newline at end of file diff --git a/NucuCar.sln.DotSettings.user b/NucuCar.sln.DotSettings.user index be70b0e..1046fae 100644 --- a/NucuCar.sln.DotSettings.user +++ b/NucuCar.sln.DotSettings.user @@ -23,6 +23,6 @@ </SessionState> <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> \ No newline at end of file