public void Default_keyed_by_header_and_query_and_disabled_query() { //Arrange string disabled = string.Concat("&", Defaults.RemoveCache.Key); string query = string.Concat(QUERY, disabled); var keyGen = new DefaultCacheKeyGenerator(new string[] { nameof(QUERY), nameof(ACCEPT) }); var request = new FakeRequest( method: METHOD, path: PATH, headers: acceptHeader, body: null, protocol: PROTOCOL, query: query); //Act string key = keyGen.Get(request); //Assert Assert.Contains(ACCEPT, key); Assert.Contains(ACCEPT_VALUE, key); Assert.Contains(QUERY, key); Assert.Contains(PATH, key); Assert.DoesNotContain(disabled, key); }
public void Default_keyed_by_form_header_query() { //Arrange var keyGen = new DefaultCacheKeyGenerator(new string[] { nameof(FORM), nameof(QUERY), nameof(ACCEPT) }); var request = new FakeRequest( method: METHOD, path: PATH, headers: acceptHeader, body: null, protocol: PROTOCOL, query: QUERY); request.Form[FORM] = FORM_VALUE; //Act string key = keyGen.Get(request); //Assert Assert.Contains(ACCEPT, key); Assert.Contains(ACCEPT_VALUE, key); Assert.Contains(QUERY, key); Assert.Contains(FORM, key); Assert.Contains(FORM_VALUE, key); Assert.Contains(PATH, key); }
public void Default_keyed_null() { //Arrange var keyGen = new DefaultCacheKeyGenerator(); //Act string key = keyGen.Get(null); //Assert Assert.Empty(key); }
public void Default_keyed_by_url_only_with_removal_key() { //Arrange var keyGen = new DefaultCacheKeyGenerator(); var request = new FakeRequest( method: METHOD, path: PATH, headers: acceptHeader, body: null, protocol: PROTOCOL, query: string.Concat(QUERY, "?RapidCacheRemove=true")); //Act string key = keyGen.Get(request); //Assert Assert.DoesNotContain(ACCEPT, key); Assert.DoesNotContain(QUERY, key); Assert.Contains(PATH, key); }
public void Default_keyed_by_query() { //Arrange var keyGen = new DefaultCacheKeyGenerator(new string[] { nameof(QUERY) }); var request = new FakeRequest( method: METHOD, path: PATH, headers: acceptHeader, body: null, protocol: PROTOCOL, query: QUERY); //Act string key = keyGen.Get(request); //Assert Assert.DoesNotContain(ACCEPT, key); Assert.Contains(QUERY, key); Assert.Contains(PATH, key); }