Exemplo n.º 1
0
        public void BeLocalRedirectResult_GivenLocalRedirectResult_ShouldPass()
        {
            const string testLocalUrl = "testLocalUrl";
            ActionResult result       = new LocalRedirectResult(testLocalUrl);

            result.Should().BeLocalRedirectResult();
        }
        public void WithLocalUrl_GivenUnexpectedLocalUrl_ShouldFail()
        {
            const string actualLocalUrl   = TestLocalUrl;
            const string expectedLocalUrl = "otherUrl";
            ActionResult result           = new LocalRedirectResult(TestLocalUrl);
            var          failureMessage   = FailureMessageHelper.ExpectedContextToBeXButY("LocalRedirectResult.LocalUrl", expectedLocalUrl, actualLocalUrl);

            Action a = () => result.Should().BeLocalRedirectResult().WithLocalUrl(expectedLocalUrl, Reason, ReasonArgs);

            a.Should().Throw <Exception>().WithMessage(failureMessage);
        }
        public void WithPreserveMethod_GivenUnexpectedPreserveMethod_ShouldFail()
        {
            var          actualPreserveMethod   = true;
            var          expectedPreserveMethod = false;
            ActionResult result = new LocalRedirectResult(TestLocalUrl)
            {
                PreserveMethod = actualPreserveMethod
            };
            var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY("LocalRedirectResult.PreserveMethod", expectedPreserveMethod, actualPreserveMethod);

            Action a = () => result.Should().BeLocalRedirectResult().WithPreserveMethod(expectedPreserveMethod, Reason, ReasonArgs);

            a.Should().Throw <Exception>().WithMessage(failureMessage);
        }
        public void WithPermanent_GivenUnexpectedPermanent_ShouldFail()
        {
            var          actualPermanent   = true;
            var          expectedPermanent = false;
            ActionResult result            = new LocalRedirectResult(TestLocalUrl)
            {
                Permanent = actualPermanent
            };
            var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY("LocalRedirectResult.Permanent", expectedPermanent, actualPermanent);

            Action a = () => result.Should().BeLocalRedirectResult().WithPermanent(expectedPermanent, Reason, ReasonArgs);

            a.Should().Throw <Exception>().WithMessage(failureMessage);
        }