public void ExoticCoverageTest()
 {
     ISectionFormatter f = new ContentSectionFormatter();
     Executing.This(() => f.Write(null)).Should().Throw<ArgumentNullException>();
     Executing.This(() => f.Read(null)).Should().Throw<ArgumentNullException>();
     f.Id.Should().Be(0x80);
 }
 public void ContentSectionFormatterEmptyDescription()
 {
     var fw = new Mock<IFormattedWriter>(MockBehavior.Strict);
     var wc = new WriteContext(fw.Object);
     ISectionFormatter f = new ContentSectionFormatter();
     f.Write(wc);
     // due to the strict behavior of the fw mock, this test succeeds only if no method of fw was called.
 }
        public void ExoticCoverageTest()
        {
            ISectionFormatter f = new ContentSectionFormatter();

            Executing.This(() => f.Write(null)).Should().Throw <ArgumentNullException>();
            Executing.This(() => f.Read(null)).Should().Throw <ArgumentNullException>();
            f.Id.Should().Be(0x80);
        }
        public void ContentSectionFormatterEmptyDescription()
        {
            var fw = new Mock <IFormattedWriter>(MockBehavior.Strict);
            var wc = new WriteContext(fw.Object);
            ISectionFormatter f = new ContentSectionFormatter();

            f.Write(wc);
            // due to the strict behavior of the fw mock, this test succeeds only if no method of fw was called.
        }
        public void ContentSectionFormatterRoundTrip()
        {
            const string testValue = "Météo pour Paris, France. @€";

            var ms = new MemoryStream();
            var fio = new FileIO(ms);
            var fw = new FormattedWriter(fio);
            var wc = new WriteContext(fw);
            wc.Description = new TeaFileDescription();
            wc.Description.ContentDescription = testValue;
            ISectionFormatter f = new ContentSectionFormatter();
            f.Write(wc);
            ms.Position = 0;
            var fr = new FormattedReader(fio);
            var rc = new ReadContext(fr);
            f.Read(rc);
            rc.Description.Should().Not.Be.Null();
            rc.Description.ContentDescription.Should().Be(testValue);
        }
        public void ContentSectionFormatterRoundTrip()
        {
            const string testValue = "Météo pour Paris, France. @€";

            var ms  = new MemoryStream();
            var fio = new FileIO(ms);
            var fw  = new FormattedWriter(fio);
            var wc  = new WriteContext(fw);

            wc.Description = new TeaFileDescription();
            wc.Description.ContentDescription = testValue;
            ISectionFormatter f = new ContentSectionFormatter();

            f.Write(wc);
            ms.Position = 0;
            var fr = new FormattedReader(fio);
            var rc = new ReadContext(fr);

            f.Read(rc);
            rc.Description.Should().Not.Be.Null();
            rc.Description.ContentDescription.Should().Be(testValue);
        }