public void WithViewData_GivenExpectedValue_ShouldPass()
        {
            var result = new TestController().PartialViewWithOneViewData();

            result.Should().BePartialViewResult().WithViewData("key1", "value1");
        }
        public void ModelAs_CastingRight_ShouldPass()
        {
            var result = new TestController().PartialViewSimpleModel();

            result.Should().BePartialViewResult().ModelAs <string>().Should().Be("hello");
        }
        public void ErrorAs_GivenExpectedError_ShouldPass()
        {
            var result = new TestController().BadRequest(TestError);

            result.Should().BeBadRequestObjectResult().ErrorAs <string>().Should().Be(TestError);
        }
コード例 #4
0
        public void ValueAs_GivenOkObjectResult_ShouldHaveTheSameValue()
        {
            var result = new TestController().Ok(TestValue);

            result.Should().BeOkObjectResult().ValueAs <string>().Should().BeSameAs(TestValue);
        }
        public void Error_GivenBadRequestObjectResult_ShouldHaveTheSameError()
        {
            var result = new TestController().BadRequest(TestError);

            result.Should().BeBadRequestObjectResult().Error.Should().BeSameAs(TestError);
        }
        public void ModelAs_GivenExpectedValue_ShouldPass()
        {
            var result = new TestController().ViewSimpleModel();

            result.Should().BeViewResult().ModelAs <string>().Should().Be("hello");
        }
        public void ModelAs_GivenExpectedValue_ShouldPass()
        {
            var result = new TestController().PartialViewSimpleModel();

            AssertionsExtensions.Should(result).BePartialViewResult().ModelAs <string>().Should().Be("hello");
        }
コード例 #8
0
        public void WithUri_GivenExpectedUriAsString_ShouldPass()
        {
            var result = new TestController().Accepted(TestUriAsString, TestValue);

            result.Should().BeAcceptedResult().WithUri(TestUriAsString);
        }
コード例 #9
0
        public void ValueAs_GivenAcceptedResult_ShouldHaveTheSameValue()
        {
            var result = new TestController().Accepted(TestUri, TestValue);

            result.Should().BeAcceptedResult().ValueAs <string>().Should().BeSameAs(TestValue);
        }