Example #1
0
        public void WithCustomUrlHelperOfTypeShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

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

            MyController <MvcController>
            .Instance()
            .Calling(c => c.CreatedAtActionWithCustomHelperResult(urlHelper))
            .ShouldReturn()
            .Created(created => created
                     .WithUrlHelperOfType <CustomUrlHelper>());
        }
        public void WithCustomUrlHelperShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

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

            MyMvc
            .Controller <MvcController>()
            .Calling(c => c.RedirectToActionWithCustomUrlHelperResult(urlHelper))
            .ShouldReturn()
            .Redirect()
            .WithUrlHelperOfType <CustomUrlHelper>();
        }
        public void WithCustomUrlHelperShouldNotThrowExceptionWithCorrectUrlHelper()
        {
            var urlHelper = TestObjectFactory.GetCustomUrlHelper();

            MyMvc
            .Controller <MvcController>()
            .Calling(c => c.CreatedAtActionWithCustomHelperResult(urlHelper))
            .ShouldReturn()
            .Created()
            .WithUrlHelper(urlHelper);
        }
Example #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.");
        }
Example #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.");
        }
Example #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.");
        }
Example #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.");
        }