public void When_creating_new_instance_should_set_defaults() { var newInstance = new ControllerChunk(); var compareToInstance = new ControllerChunk { ParentFile = null, FileOffset = 0, Magic = DatFile.Magics.Controller, Id = 0, ParentId = 0, SubType = 0, Name = null }; // Assert newInstance.Should().BeEquivalentTo(compareToInstance); }
public async Task When_serializing_and_then_deserializing_should_produce_equivalent(string controllerName) { var chunk = new ControllerChunk { Id = 456, ParentId = 123, Name = controllerName }; using (var ms = new MemoryStream()) { await chunk.SerializeAsync(ms, false); ms.Position = 0; // Act var deserializedChunk = new ControllerChunk(); await deserializedChunk.DeserializeAsync(ms, false); // Assert deserializedChunk.Should().BeEquivalentTo(chunk); ms.Should().BeEof(); } }