コード例 #1
0
        public void WithCustomUrlHelperOfTypeShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

            MyController <MvcController>
            .Instance()
            .Calling(c => c.LocalRedirectActionWithCustomUrlHelper(urlHelper))
            .ShouldReturn()
            .LocalRedirect()
            .WithUrlHelperOfType <CustomUrlHelper>();
        }
コード例 #2
0
        public void WithCustomUrlHelperOfTypeShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

            MyController <MvcController>
            .Instance()
            .Calling(c => c.CreatedAtActionWithCustomHelperResult(urlHelper))
            .ShouldReturn()
            .Created(created => created
                     .WithUrlHelperOfType <CustomUrlHelper>());
        }
コード例 #3
0
        public void WithCustomUrlHelperShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

            MyController <MvcController>
            .Instance()
            .Calling(c => c.RedirectToActionWithCustomUrlHelperResult(urlHelper))
            .ShouldReturn()
            .Redirect(redirect => redirect
                      .WithUrlHelper(urlHelper));
        }
コード例 #4
0
        public void WithCustomUrlHelperOfTypeShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

            MyMvc
            .Controller <MvcController>()
            .Calling(c => c.RedirectToActionWithCustomUrlHelperResult(urlHelper))
            .ShouldReturn()
            .Redirect()
            .WithUrlHelperOfType <CustomUrlHelper>();
        }
コード例 #5
0
        public void WithCustomUrlHelperShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

            MyMvc
            .Controller <MvcController>()
            .Calling(c => c.CreatedAtActionWithCustomHelperResult(urlHelper))
            .ShouldReturn()
            .Created()
            .WithUrlHelper(urlHelper);
        }
コード例 #6
0
        public void WithCustomUrlHelperOfTypeShouldThrowExceptionWithIncorrectUrlHelper()
        {
            Test.AssertException <RedirectResultAssertionException>(
                () =>
            {
                var urlHelper = TestObjectFactory.GetCustomUrlHelper();

                MyController <MvcController>
                .Instance()
                .Calling(c => c.LocalRedirectActionWithCustomUrlHelper(urlHelper))
                .ShouldReturn()
                .LocalRedirect()
                .WithUrlHelperOfType <IUrlHelper>();
            },
                "When calling LocalRedirectActionWithCustomUrlHelper action in MvcController expected local redirect result UrlHelper to be of IUrlHelper type, but instead received CustomUrlHelper.");
        }
コード例 #7
0
        public void WithCustomUrlHelperShouldThrowExceptionWithIncorrectUrlHelper()
        {
            Test.AssertException <RedirectResultAssertionException>(
                () =>
            {
                var urlHelper = TestObjectFactory.GetCustomUrlHelper();

                MyController <MvcController>
                .Instance()
                .Calling(c => c.LocalRedirectActionWithCustomUrlHelper(urlHelper))
                .ShouldReturn()
                .LocalRedirect()
                .WithUrlHelper(null);
            },
                "When calling LocalRedirectActionWithCustomUrlHelper action in MvcController expected local redirect result UrlHelper to be the same as the provided one, but instead received different result.");
        }
コード例 #8
0
        public void WithCustomUrlHelperOfTypeShouldThrowExceptionWithIncorrectUrlHelper()
        {
            Test.AssertException <CreatedResultAssertionException>(
                () =>
            {
                var urlHelper = TestObjectFactory.GetCustomUrlHelper();

                MyController <MvcController>
                .Instance()
                .Calling(c => c.CreatedAtActionWithCustomHelperResult(urlHelper))
                .ShouldReturn()
                .Created(created => created
                         .WithUrlHelperOfType <IUrlHelper>());
            },
                "When calling CreatedAtActionWithCustomHelperResult action in MvcController expected created result URL helper to be of IUrlHelper type, but instead received CustomUrlHelper.");
        }
コード例 #9
0
        public void WithCustomUrlHelperShouldThrowExceptionWithIncorrectUrlHelper()
        {
            Test.AssertException <CreatedResultAssertionException>(
                () =>
            {
                var urlHelper = TestObjectFactory.GetCustomUrlHelper();

                MyController <MvcController>
                .Instance()
                .Calling(c => c.CreatedAtActionWithCustomHelperResult(urlHelper))
                .ShouldReturn()
                .Created(created => created
                         .WithUrlHelper(null));
            },
                "When calling CreatedAtActionWithCustomHelperResult action in MvcController expected created result URL helper to be the same as the provided one, but instead received different result.");
        }