Beispiel #1
0
        public void SetContentStringEncoding_GivenEncodingNull_ThrowsArgumentNullException()
        {
            // Arrage
            var messageBody = new HttpMessageBody();

            // Act & Assert
            Assert.ThrowsException <ArgumentNullException>(() => messageBody.SetContent(string.Empty, null));
        }
Beispiel #2
0
        public void Count_SetContentToListOfZeroElements_Returns0()
        {
            // Arrange
            var messageBody = new HttpMessageBody();

            // Act
            messageBody.SetContent(new List <byte>());

            // Assert
            Assert.AreEqual(0, messageBody.Count);
        }
Beispiel #3
0
        public void HasBody_AddBody_ReturnsTrue()
        {
            // Arrange
            var messageBody = new HttpMessageBody();

            // Act
            messageBody.SetContent("AAA");

            // Assert
            Assert.IsTrue(messageBody.HasBody);
        }
Beispiel #4
0
        public void Count_SetContentToNull_Returns0()
        {
            // Arrange
            var messageBody = new HttpMessageBody();

            // Act
            messageBody.SetContent((List <byte>)null);

            // Assert
            Assert.AreEqual(0, messageBody.Count);
        }
Beispiel #5
0
        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());
        }
Beispiel #6
0
        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());
        }
Beispiel #7
0
        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);
        }