Пример #1
0
        public void RedirectLocal_WithInvalidLocalUrl_ThrowsInvalidOperationException()
        {
            const string             url = "www.foobar.com/foo/bar";
            MvcControllerBaseWrapper sut = CreateSut();

            sut.Url = GetUrlHelperForIsLocalUrl();

            Assert.Throws <InvalidOperationException>(() => sut.RedirectLocal(url));
        }
Пример #2
0
        public void RedirectLocal_WithValidLocalUrl_ReturnsExpectedRedirectResult()
        {
            const string             url = "/foo/bar";
            MvcControllerBaseWrapper sut = CreateSut();

            sut.Url = GetUrlHelperForIsLocalUrl();

            RedirectResult result = sut.RedirectLocal(url);

            Assert.IsNotNull(result);
            Assert.AreEqual(url, result.Url);
        }
Пример #3
0
        public void RedirectLocal_WithNullLocalUrl_ReturnsRedirectToRoot()
        {
            const string             url = null;
            const string             expectedRedirectUrl = "/";
            MvcControllerBaseWrapper sut = CreateSut();

            sut.Url = GetUrlHelperForIsLocalUrl();

            RedirectResult result = sut.RedirectLocal(url);

            Assert.IsNotNull(result);
            Assert.AreEqual(expectedRedirectUrl, result.Url);
        }
Пример #4
0
        public void Settings_ReturnsContextSettings()
        {
            MvcControllerBaseWrapper sut = CreateSut();

            Assert.AreSame(_mocks.ControllerContext.Object.Settings, sut.ProtectedSettings);
        }
Пример #5
0
        public void State_ReturnsContextState()
        {
            MvcControllerBaseWrapper sut = CreateSut();

            Assert.AreSame(_mocks.ControllerContext.Object.State, sut.ProtectedState);
        }