public void ModelAs_GivenWrongType_ShouldFail()
        {
            var result = new TestController().PartialViewSimpleModel();

            Action a = () => AssertionsExtensions.Should(result).BePartialViewResult().ModelAs <int>().Should().Be(2);

            a.Should().Throw <Exception>();
        }
        public void ModelAs_GivenUnexpectedValue_ShouldFail()
        {
            var result = new TestController().PartialViewSimpleModel();

            Action a = () => AssertionsExtensions.Should(result).BePartialViewResult().ModelAs <string>().Should().Be("xyx");

            a.Should().Throw <Exception>();
        }
        public void ModelAs_GivenWrongType_ShouldFail()
        {
            var result = new TestController().PartialViewSimpleModel();

            Action a = () => AssertionsExtensions.Should(result).BePartialViewResult().ModelAs <int>().Should().Be(2);

            a.Should().Throw <Exception>()
            .WithMessage("Expected PartialViewResult.Model to be of type System.Int32 but was System.String.");
        }
        public void WithDefaultViewName_GivenExpectedValue_ShouldPass()
        {
            ActionResult result = new PartialViewResult
            {
                ViewName = String.Empty
            };

            AssertionsExtensions.Should(result).BePartialViewResult().WithDefaultViewName();
        }
        public void ModelAs_Null_ShouldFail()
        {
            ActionResult result         = new PartialViewResult();
            const string failureMessage = "Expected PartialViewResult.Model to be of type System.Object, but no value was supplied.";

            Action a = () => AssertionsExtensions.Should(result).BePartialViewResult().ModelAs <Object>();

            a.Should().Throw <Exception>()
            .WithMessage(failureMessage);
        }
        public void ModelAs_Null_ShouldFail()
        {
            ActionResult result         = new PartialViewResult();
            string       failureMessage = FailureMessageHelper.Format(FailureMessages.ViewResultBase_NullModel, typeof(Object).Name);

            Action a = () =>
            {
                AssertionsExtensions.Should(result).BePartialViewResult().ModelAs <Object>();
            };

            a.Should().Throw <Exception>()
            .WithMessage(failureMessage);
        }
        public void ModelAs_GivenExpectedValue_ShouldPass()
        {
            var result = new TestController().PartialViewSimpleModel();

            AssertionsExtensions.Should(result).BePartialViewResult().ModelAs <string>().Should().Be("hello");
        }