public void SerializeCycleTest() { var serializer = new BinarySerializer(); { using (var memoryStream = new PooledMemoryStream(new ArrayPool(), 128)) { serializer.Serialize(Objects[0], memoryStream); var data = memoryStream.GetBuffer(); var dto = serializer.DeserializeAs <TestDto>(data, 0, (int)memoryStream.Length); dto.Should().BeEquivalentTo(Objects[0]); } } }