public void should_validate_with_correct_request_data_from_header() { Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("User"), null); MockFor <IIdentity>().Stub(x => x.IsAuthenticated).Return(true); MockFor <IIdentity>().Stub(x => x.Name).Return("User"); _cookies.Stub(x => x.Get("CookieName")).Return(new Cookie("CookieName", "CookieValue")); _headerSource.Stub(x => x.Get("FormName")).Return("FormValue"); ClassUnderTest.Validate("Salty").ShouldBeTrue(); }
public void should_not_validate_with_incorrect_user() { SetupIdentity(true, "DifferentUser"); _cookies.Stub(x => x.Get("CookieName")).Return(new Cookie("CookieName", "CookieValue")); _valueSource.Stub(x => x.Get("FormName")).Return("FormValue"); ClassUnderTest.Validate("Salty").ShouldBeFalse(); }