public void SetOverriddenUserWithExistingResponseCookie() { // Arrange CookieBrowserOverrideStore store = new CookieBrowserOverrideStore(); HttpContextBase context = CreateCookieContext().Object; // Act & Assert store.SetOverriddenUserAgent(context, "testUserAgent"); Assert.Equal("testUserAgent", store.GetOverriddenUserAgent(context)); store.SetOverriddenUserAgent(context, "subsequentTestUserAgent"); Assert.Equal("subsequentTestUserAgent", store.GetOverriddenUserAgent(context)); }
public void GetOverriddenUserAgentReturnsNullIfNoResponseOrRequestCookieIsSet() { // Arrange CookieBrowserOverrideStore store = new CookieBrowserOverrideStore(); // Act & Assert Assert.Null(store.GetOverriddenUserAgent(CreateCookieContext().Object)); }
public void GetOverriddenUserAgentReturnsUserAgentFromRequestCookieIfNoResponseCookie() { // Arrange CookieBrowserOverrideStore store = new CookieBrowserOverrideStore(); HttpCookie existingOverrideCookie = new HttpCookie(CookieBrowserOverrideStore.BrowserOverrideCookieName, "existingRequestAgent"); HttpContextBase context = CreateCookieContext(requestCookie: existingOverrideCookie).Object; // Act & Assert Assert.Equal("existingRequestAgent", store.GetOverriddenUserAgent(context)); }
public void SetOverriddenUserAgentWithNoExistingCookie() { // Arrange CookieBrowserOverrideStore store = new CookieBrowserOverrideStore(); HttpContextBase context = CreateCookieContext().Object; // Act store.SetOverriddenUserAgent(context, "setUserAgent"); // Assert Assert.Equal("setUserAgent", store.GetOverriddenUserAgent(context)); }
public void SetOverriddenUserAgentNullWithRequestCookie() { // Arrange CookieBrowserOverrideStore store = new CookieBrowserOverrideStore(); HttpCookie existingOverrideCookie = new HttpCookie(CookieBrowserOverrideStore.BrowserOverrideCookieName, "setUserAgent"); HttpContextBase context = CreateCookieContext(requestCookie: existingOverrideCookie).Object; // Act store.SetOverriddenUserAgent(context, null); // Assert Assert.Null(store.GetOverriddenUserAgent(context)); }
public void SetOverriddenUserWithExistingRequestCookie() { // Arrange CookieBrowserOverrideStore store = new CookieBrowserOverrideStore(); HttpCookie existingOverrideCookie = new HttpCookie(CookieBrowserOverrideStore.BrowserOverrideCookieName, "existingRequestAgent"); HttpContextBase context = CreateCookieContext(requestCookie: existingOverrideCookie).Object; // Act store.SetOverriddenUserAgent(context, "setUserAgent"); // Assert Assert.Equal("setUserAgent", store.GetOverriddenUserAgent(context)); }