public void CheckIfTypeCanBeNullShouldThrowExceptionWithStruct() { Test.AssertException <ActionCallAssertionException>( () => { CommonValidator.CheckIfTypeCanBeNull(typeof(int)); }, "Int32 cannot be null."); }
/// <inheritdoc /> public IBaseTestBuilderWithViewComponentResult <TInvocationResult> NotNull() { CommonValidator.CheckIfTypeCanBeNull(typeof(TInvocationResult)); if (this.CheckValidDefaultValue()) { this.ThrowNewActionResultAssertionException(string.Format( "not null, but it was {0} object.", typeof(TInvocationResult).ToFriendlyTypeName())); } return(this.NewAndTestBuilderWithViewComponentResult()); }
/// <summary> /// Tests whether action result is null. /// </summary> /// <returns>Base test builder with action result.</returns> public IBaseTestBuilderWithActionResult <TActionResult> Null() { CommonValidator.CheckIfTypeCanBeNull(typeof(TActionResult)); if (!this.CheckValidDefaultValue()) { this.ThrowNewHttpActionResultAssertionException(string.Format( "null, but instead received {0}.", typeof(TActionResult).ToFriendlyTypeName())); } return(this.NewAndProvideTestBuilder()); }
/// <inheritdoc /> public IAndTestBuilder NotNull() { CommonValidator.CheckIfTypeCanBeNull(typeof(TInvocationResult)); if (this.CheckValidDefaultValue()) { this.ThrowNewActionResultAssertionException(string.Format( "not null, but it was {0} object.", typeof(TInvocationResult).ToFriendlyTypeName())); } return(new AndTestBuilder(this.TestContext)); }
/// <inheritdoc /> public IAndTestBuilder Null() { CommonValidator.CheckIfTypeCanBeNull(typeof(TActionResult)); if (!this.CheckValidDefaultValue()) { this.ThrowNewActionResultAssertionException(string.Format( "null, but instead received {0}.", typeof(TActionResult).ToFriendlyTypeName())); } return(new AndTestBuilder(this.TestContext)); }
public void CheckIfTypeCanBeNullShouldNotThrowExceptionWithNullableType() { CommonValidator.CheckIfTypeCanBeNull(typeof(int?)); }
public void CheckIfTypeCanBeNullShouldNotThrowExceptionWithClass() { CommonValidator.CheckIfTypeCanBeNull(typeof(object)); }
public void CheckIfTypeCanBeNullShouldThrowExceptionWithStruct() { CommonValidator.CheckIfTypeCanBeNull(typeof(int)); }