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)); }
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); }
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); }
public void Settings_ReturnsContextSettings() { MvcControllerBaseWrapper sut = CreateSut(); Assert.AreSame(_mocks.ControllerContext.Object.Settings, sut.ProtectedSettings); }
public void State_ReturnsContextState() { MvcControllerBaseWrapper sut = CreateSut(); Assert.AreSame(_mocks.ControllerContext.Object.State, sut.ProtectedState); }