public void Clear_WithPopulatedList_RemoveAllItems() { var headers = new HttpHeaders(); headers["abc"] = "123"; headers.Clear(); Assert.AreEqual(0, headers.Count); }
public void HeaderNames_WithPopulatedItems_ReturnsCollection() { var headers = new HttpHeaders(); headers["abc"] = "123"; var headerNames = headers.HeaderNames; Assert.AreEqual(1, headerNames.Count); }
public void CopyTo_WithValidHeaders_CopiesAllHeaders() { var source = new HttpHeaders(); var target = new HttpHeaders(); source["abc"] = "123"; source["def"] = "456"; source.CopyTo(target); Assert.AreEqual(source.Count, target.Count); }
public void CopyTo_WithValidHeaders_UpdatesExistingHeaders() { var source = new HttpHeaders(); var target = new HttpHeaders(); source["abc"] = "123"; source["def"] = "456"; target["abc"] = "999"; source.CopyTo(target); Assert.AreEqual(source.Count, target.Count); Assert.AreEqual(source["abc"], target["abc"]); }
public void IndexerGet_WithValidHeaderNameDifferentCase_ReturnsValue() { var headers = new HttpHeaders(); headers["abc"] = "123"; Assert.AreEqual("123", headers["ABC"]); }
public void IndexerGet_WithInvalidHeaderName_ReturnsNull() { var headers = new HttpHeaders(); headers["abc"] = "123"; Assert.IsNull(headers["NoHeader"]); }
public void Count_WhenItemsAdded_ReturnsRealNumber() { var headers = new HttpHeaders(); headers["abc"] = "123"; Assert.AreEqual(1, headers.Count); }
public void Constructor_WithDefaults_HasNoHeaders() { var headers = new HttpHeaders(); Assert.AreEqual(0, headers.Count); }
public void Remove_WithValidName_ReturnsTrue() { var headers = new HttpHeaders(); headers["abc"] = "123"; Assert.IsTrue(headers.Remove("abc")); }
public void Remove_WithValidName_RemoveFromList() { var headers = new HttpHeaders(); headers["abc"] = "123"; headers.Remove("abc"); Assert.AreEqual(0, headers.Count); }
public void Remove_WithInvalidName_ReturnsFalse() { var headers = new HttpHeaders(); headers["abc"] = "123"; Assert.IsFalse(headers.Remove("defg")); }
public void IsReadOnly_WithGet_ReturnsFalse() { var headers = new HttpHeaders(); Assert.IsFalse(headers.IsReadOnly); }
public void IndexerSet_WithSameName_UpdatesValue() { var headers = new HttpHeaders(); headers["abc"] = "123"; headers["abc"] = "456"; Assert.AreEqual("456", headers["abc"]); }
public void IndexerSet_WithNullValue_DoesNothing() { var headers = new HttpHeaders(); Assert.DoesNotThrow(() => headers["abcd"] = null); Assert.AreEqual(0, headers.Count); }
public void IndexerSet_WithNullName_DoesNothing() { var headers = new HttpHeaders(); Assert.DoesNotThrow(() => headers[null] = "1234"); Assert.AreEqual(0, headers.Count); }
public void IndexerSet_WithNewValue_AddsToCollection() { var headers = new HttpHeaders(); headers["abc"] = "123"; Assert.AreEqual(1, headers.Count); }