Esempio n. 1
0
        public void WriteLength()
        {
            // Arrange
            m_mockBinaryWriter.Setup(writer => writer.Write(It.IsAny <byte[]>(), 0, It.IsAny <int>()))
            .Returns(0);

            // Act
            m_builder.WriteLength(1000);

            // Assert
            m_builder.WriteTo(m_mockBinaryWriter.Object);
        }
Esempio n. 2
0
        public void WriteLength()
        {
            // Arrange
            string result = null;

            m_mockBinaryWriter.Setup(writer => writer.Write(It.IsAny <byte[]>(), 0, It.IsAny <int>()))
            .Callback <byte[], int, int>((b, i, c) =>
                                         result = Encoding.ASCII.GetString(b, i, c - 2)).Returns(0);

            // Act
            m_builder.WriteLength(1234567890);

            // Assert
            m_builder.WriteTo(m_mockBinaryWriter.Object);
            Assert.Equal(" 1234567890", result);
        }