public void TestThatNotNullOrEmptyReturnsArgumentNullGuardWhenStringValueIsNotNull(string value) { IArgumentNullGuard sut = CreateSut(); string argumentName = _fixture.Create <string>(); IArgumentNullGuard result = sut.NotNullOrEmpty(value, argumentName); Assert.IsNotNull(result); Assert.AreSame(sut, result); }
public void TestThatNotNullOrEmptyThrowsArgumentNullExceptionWhenStringValueIsNullOrEmpty(string value) { IArgumentNullGuard sut = CreateSut(); string argumentName = _fixture.Create <string>(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.NotNullOrEmpty(value, argumentName)); TestHelper.AssertArgumentNullExceptionIsValid(result, argumentName); }
/// <summary> /// Validates whether the <paramref name="value"/> is null or empty and throws an <see cref="ArgumentNullException"/> when so. /// </summary> /// <param name="value">The value to validate.</param> /// <param name="argumentName">The name of the argument.</param> /// <returns>Instance of Argument Null Guard.</returns> /// <exception cref="ArgumentNullException">Thrown when the <see cref="value"/> is null or empty or when the <see cref="argumentName"/> is null, empty or white space.</exception> public static IArgumentNullGuard NotNullOrEmpty(string value, string argumentName) { IArgumentNullGuard argumentNullGuard = Create(); return(argumentNullGuard.NotNullOrEmpty(value, argumentName)); }