public void DeleteCookieShouldSetDefaultPath() { var headers = new HeaderDictionary(); var cookies = new ResponseCookies(headers); var testcookie = "TestCookie"; cookies.Delete(testcookie); var cookieHeaderValues = headers[HeaderNames.SetCookie]; Assert.Equal(1, cookieHeaderValues.Count); Assert.StartsWith(testcookie, cookieHeaderValues[0]); Assert.Contains("path=/", cookieHeaderValues[0]); Assert.Contains("expires=Thu, 01 Jan 1970 00:00:00 GMT", cookieHeaderValues[0]); }
public void NoParamsDeleteRemovesCookieCreatedByAdd() { var headers = new HeaderDictionary(); var cookies = new ResponseCookies(headers); var testcookie = "TestCookie"; cookies.Append(testcookie, testcookie); cookies.Delete(testcookie); var cookieHeaderValues = headers[HeaderNames.SetCookie]; Assert.Equal(1, cookieHeaderValues.Count); Assert.StartsWith(testcookie, cookieHeaderValues[0]); Assert.Contains("path=/", cookieHeaderValues[0]); Assert.Contains("expires=Thu, 01 Jan 1970 00:00:00 GMT", cookieHeaderValues[0]); }