예제 #1
0
        public void MetadataUnitTest_2()
        {
            var sourceBytes = new byte[]
            {
                2, 3, // initial bytes not changed
                3, 0, 0, 0, 0, 0, 0, 0,
                5, 0, 0, 0, 0, 0, 0, 0,
                10, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, 0, 0,
                1, 0, 0, 0 // number of records at the end
            };

            var metadata = new FileMetadata();

            using (var ms = new MemoryStream())
            {
                ms.Write(sourceBytes, 0, sourceBytes.Length);
                metadata.Read(ms);
            }

            var expectedMetadata = new FileMetadata();

            expectedMetadata.AddRecord(new MetadataRecord(3, 5, 10, 0));

            metadata.Should().BeEquivalentTo(expectedMetadata);
        }