public async Task Given_stream_contains_more_data_than_chunk_needs_should_advance_to_end()
        {
            var chunk = new MaterialChunk();

            using (var ms = new MemoryStream())
            {
                await chunk.SerializeAsync(ms, false);

                // Add garbage to end.
                ms.Write(new byte[] { 0x1, 0x2 }, 0, 2);
                ms.Position = 0;

                // Act
                await chunk.DeserializeAsync(ms, false);

                // Assert
                ms.Should().BeEof();
            }
        }
        public async Task When_serializing_and_then_deserializing_should_produce_equivalent(string texture, int tgaTextureSize)
        {
            var chunk = new MaterialChunk
            {
                Id             = 456,
                CreationTime   = new DateTime(2008, 8, 13, 16, 50, 13),
                Texture        = texture,
                TgaTextureSize = tgaTextureSize
            };

            using (var ms = new MemoryStream())
            {
                await chunk.SerializeAsync(ms, false);

                ms.Position = 0;

                // Act
                var deserializedChunk = new MaterialChunk();
                await deserializedChunk.DeserializeAsync(ms, false);

                // Assert
                if (deserializedChunk.HasTextureReference)
                {
                    deserializedChunk.Should().BeEquivalentTo(chunk);
                }
                else
                {
                    deserializedChunk.Should().BeEquivalentTo(chunk,
                                                              opts => opts
                                                              .Excluding(c => c.CreationTime)
                                                              .Excluding(c => c.Texture));
                }

                ms.Should().BeEof();
            }
        }