public void SetParsedValue_SetTwoValuesToNonExistingHeader_HeaderGetsCreatedAndLastValueAdded() { Uri headerValue1 = new Uri("http://example.org/1/"); Uri headerValue2 = new Uri("http://example.org/2/"); CustomTypeHeaders headers = new CustomTypeHeaders("myheader", new CustomTypeHeaderParser()); headers.SetParsedValue("myheader", headerValue1); // The following line will remove the previously added values and replace them with the provided value. headers.SetParsedValue("myheader", headerValue2); Assert.True(headers.Contains("myheader"), "Store doesn't have the header after adding a value to it."); Assert.Equal(1, headers.GetValues("myheader").Count()); // The second value replaces the first value. Assert.Equal(headerValue2.ToString(), headers.First().Value.ElementAt(0)); }
public void SetParsedValue_AddSingleValueToNonExistingHeader_HeaderGetsCreatedAndValueAdded() { Uri headerValue = new Uri("http://example.org/"); CustomTypeHeaders headers = new CustomTypeHeaders("myheader", new CustomTypeHeaderParser()); headers.SetParsedValue("myheader", headerValue); Assert.True(headers.Contains("myheader"), "Store doesn't have the header after adding a value to it."); Assert.Equal(headerValue.ToString(), headers.First().Value.ElementAt(0)); }