using System;
using NucuCar.Core.Utilities;
using Xunit;
namespace NucuCar.UnitTests.NucuCar.Core
{
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"));
}
}
}