/// <summary> /// This method clears the request builder, so it can be used to build a new request. /// </summary> public void Clear() { _httpHeaders.Clear(); _httpMethod = null; _target = null; _httpVersion = null; _httpMessageBody = new HttpMessageBody(); }
public void HasBody_NoBody_ReturnsFalse() { // Arrange var messageBody = new HttpMessageBody(); // Assert Assert.IsFalse(messageBody.HasBody); }
public void AddContentChunk_GivenNull_ThrowsArgumentNullException() { // Arrange var messageBody = new HttpMessageBody(); // Act & Assert Assert.ThrowsException <ArgumentNullException>(() => messageBody.AddContentChunk(null)); }
public void GetContentStringEncoding_GivenNull_ThrowsArgumentNullException() { // Arrage var messageBody = new HttpMessageBody(); // Act & Assert Assert.ThrowsException <ArgumentNullException>(() => messageBody.GetContentString(null)); }
public void Count_SetContentToListOfZeroElements_Returns0() { // Arrange var messageBody = new HttpMessageBody(); // Act messageBody.SetContent(new List <byte>()); // Assert Assert.AreEqual(0, messageBody.Count); }
public void HasBody_AddBody_ReturnsTrue() { // Arrange var messageBody = new HttpMessageBody(); // Act messageBody.SetContent("AAA"); // Assert Assert.IsTrue(messageBody.HasBody); }
public void Count_SetContentToNull_Returns0() { // Arrange var messageBody = new HttpMessageBody(); // Act messageBody.SetContent((List <byte>)null); // Assert Assert.AreEqual(0, messageBody.Count); }
public void GetContentString_SetContentToString_ReturnsTheSameString() { // Arrange var messageBody = new HttpMessageBody(); const string content = "467y4higifgerhtthąśććąę123123"; // Act messageBody.SetContent(content); // Assert Assert.AreEqual(content, messageBody.GetContentString()); }
public void AddContentChunk_EmptyMessageBodyAndGivenSomeData_ContentIsTheSame() { // Arrange var messageBody = new HttpMessageBody(); var content = new List <byte> { 0x41, 0x41, 0x41, 0x41 }; // Act messageBody.AddContentChunk(content); // Assert CollectionAssert.AreEqual(content, messageBody.GetContent()); }
public void AddContentChunk_AddTwoChunks_GetContentReturnsCombinedContent() { // Arrange var messageBody = new HttpMessageBody(); var content = new List <byte> { 0x41, 0x41, 0x41, 0x41 }; messageBody.AddContentChunk(content); // Act messageBody.AddContentChunk(content); // Assert content.AddRange(content); CollectionAssert.AreEqual(content, messageBody.GetContent()); }
public void GetContent_SetContentToASequenceOfBytes_ReturnsTheSameList() { // Arrange var messageBody = new HttpMessageBody(); var bytes = new List <byte> { 45, 67, 82, 16, 0, 255 }; // Act messageBody.SetContent(bytes); // Assert CollectionAssert.AreEqual(bytes, messageBody.GetContent()); }
public void Count_SetContentToListOfBytes_ReturnsTheSizeOfTheList() { // Arrange var messageBody = new HttpMessageBody(); var bytes = new List <byte> { 45, 67, 82, 16, 0, 255 }; // Act messageBody.SetContent(bytes); // Assert Assert.AreEqual(bytes.Count, messageBody.Count); }