public void CheckIfTypeCanBeNullShouldThrowExceptionWithStruct()
 {
     Test.AssertException <ActionCallAssertionException>(
         () =>
     {
         CommonValidator.CheckIfTypeCanBeNull(typeof(int));
     },
         "Int32 cannot be null.");
 }
예제 #2
0
        /// <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());
        }
예제 #3
0
        /// <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));
        }
예제 #5
0
        /// <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));
 }
예제 #8
0
 public void CheckIfTypeCanBeNullShouldThrowExceptionWithStruct()
 {
     CommonValidator.CheckIfTypeCanBeNull(typeof(int));
 }