public void WriteNullTextTest()
        {
            const string testText = null;
            var          fio      = new Mock <IFileIO>(MockBehavior.Strict);

            fio.Setup(io => io.WriteInt32(It.IsAny <int>()));
            fio.Setup(io => io.WriteBytes(It.IsAny <byte[]>()));
            FormattedWriter fw = new FormattedWriter(fio.Object);

            fw.WriteText(testText);
            fio.Verify(f => f.WriteInt32(0), Times.Once());
        }
        public void WriteTextTest()
        {
            const string testText =
                "Traditionnellement, il est conseillé d'accompagner cette soupe et ses poissons soit d'un vin rosé issu du vignoble de Provence, soit d'un vin rouge. €";
            var fio = new Mock <IFileIO>(MockBehavior.Strict);

            fio.Setup(io => io.WriteInt32(It.IsAny <int>()));
            fio.Setup(io => io.WriteBytes(It.IsAny <byte[]>()));
            FormattedWriter fw = new FormattedWriter(fio.Object);

            fw.WriteText(testText);
            fio.Verify(f => f.WriteInt32(It.Is <int>(n => n >= testText.Length)), Times.Once());
            fio.Verify(f => f.WriteBytes(It.Is <byte[]>(bytes => (new UTF8Encoding(false, true).GetString(bytes)) == testText)), Times.Once());
        }
 public void WriteTextTest()
 {
     const string testText =
         "Traditionnellement, il est conseillé d'accompagner cette soupe et ses poissons soit d'un vin rosé issu du vignoble de Provence, soit d'un vin rouge. €";
     var fio = new Mock<IFileIO>(MockBehavior.Strict);
     fio.Setup(io => io.WriteInt32(It.IsAny<int>()));
     fio.Setup(io => io.WriteBytes(It.IsAny<byte[]>()));
     FormattedWriter fw = new FormattedWriter(fio.Object);
     fw.WriteText(testText);
     fio.Verify(f => f.WriteInt32(It.Is<int>(n => n >= testText.Length)), Times.Once());
     fio.Verify(f => f.WriteBytes(It.Is<byte[]>(bytes => (new UTF8Encoding(false, true).GetString(bytes)) == testText)), Times.Once());
 }
 public void WriteNullTextTest()
 {
     const string testText = null;
     var fio = new Mock<IFileIO>(MockBehavior.Strict);
     fio.Setup(io => io.WriteInt32(It.IsAny<int>()));
     fio.Setup(io => io.WriteBytes(It.IsAny<byte[]>()));
     FormattedWriter fw = new FormattedWriter(fio.Object);
     fw.WriteText(testText);
     fio.Verify(f => f.WriteInt32(0), Times.Once());
 }