public void ApplyReturnUrlMapping_ReturnUrlNotMapped_ReturnsRedirectUriUnchanged() { // Arrange CookieApplyRedirectContext context = A.Fake<CookieApplyRedirectContext>(); context.RedirectUri = "https://weee.com/sign-in?ReturnUrl=%2fcontroller1%2faction1"; IReturnUrlMapping mapping = A.Fake<IReturnUrlMapping>(); A.CallTo(() => mapping.IsMapped("/mycontroller/myaction")).Returns(false); WeeeCookieAuthenticationProvider provider = new WeeeCookieAuthenticationProvider(mapping); // Act provider.ApplyReturnUrlMapping(context); // Assert Assert.Equal("https://weee.com/sign-in?ReturnUrl=%2fcontroller1%2faction1", context.RedirectUri); }
public void ApplyReturnUrlMapping_ReturnUrlMappedToNull_ReturnsRedirectUriWithoutReturnUrl() { // Arrange CookieApplyRedirectContext context = A.Fake<CookieApplyRedirectContext>(); context.RedirectUri = "https://weee.com/sign-in?ReturnUrl=%2fcontroller1%2faction1"; IReturnUrlMapping mapping = A.Fake<IReturnUrlMapping>(); A.CallTo(() => mapping.IsMapped("/controller1/action1")).Returns(true); A.CallTo(() => mapping.ApplyMap("/controller1/action1")).Returns(null); WeeeCookieAuthenticationProvider provider = new WeeeCookieAuthenticationProvider(mapping); // Act provider.ApplyReturnUrlMapping(context); // Assert Assert.Equal("https://weee.com/sign-in", context.RedirectUri); }