public void IsGuid_When_valid_Guid_returns_Guid() { var value = Guid.NewGuid().ToString(); ShouldNotThrow( () => Ensure.That(value, ParamName).IsGuid(), () => EnsureArg.IsGuid(value, ParamName)); }
public void IsGuid_When_null_It_should_not_throw_ArgumentNullException() { string value = null; ShouldThrowButNot <ArgumentNullException>( () => Ensure.That(value, ParamName).IsGuid(), () => EnsureArg.IsGuid(value, ParamName)); }
public void IsGuid_When_is_not_Guid_throws_ArgumentException() { const string value = "324-3243-123-23"; ShouldThrow <ArgumentException>( string.Format(ExceptionMessages.Strings_IsGuid_Failed, value), () => Ensure.That(value, ParamName).IsGuid(), () => EnsureArg.IsGuid(value, ParamName)); }
public void IsGuid_When_null_It_should_throw_ArgumentException() { string value = null; ShouldThrow <ArgumentException>( string.Format(ExceptionMessages.Strings_IsGuid_Failed, value), () => Ensure.That(value, ParamName).IsGuid(), () => EnsureArg.IsGuid(value, ParamName)); }
public void IsGuid_When_valid_Guid_returns_Guid() { var value = Guid.NewGuid().ToString(); var returnedValue = Ensure.That(value, ParamName).IsGuid(); AssertReturnedAsExpected(returnedValue, value); Action a = () => EnsureArg.IsGuid(value, ParamName); a.ShouldNotThrow(); }
public void IsGuid_When_valid_Guid_It_should_not_throw_and_should_return_Guid() { var value = Guid.NewGuid(); var valueAsString = value.ToString(); ShouldNotThrow( () => Ensure.String.IsGuid(valueAsString, ParamName), () => EnsureArg.IsGuid(valueAsString, ParamName), () => Ensure.That(valueAsString, ParamName).IsGuid()); ShouldReturn( value, () => Ensure.String.IsGuid(valueAsString), () => EnsureArg.IsGuid(valueAsString)); }