public async Task WriteToStreamAsync_WritesNullObject() { // Assert var content = new StreamMessagePackHttpContent(); // Act await _formatter.WriteToStreamAsync(typeof(object), null, content.Stream, content, _context); // Assert var result = await content.ReadObjectAsync <SimpleType>(_serializerOptions); Assert.Null(result); }
public async Task WriteToStreamAsync_WritesComplexType() { // Arrange var input = ComplexType.Create(); var content = new StreamMessagePackHttpContent(); // Act await _formatter.WriteToStreamAsync(typeof(ComplexType), input, content.Stream, content, _context); // Assert var result = await content.ReadObjectAsync <ComplexType>(_serializerOptions); result.Verify(); }
public async Task WriteToStreamAsync_WritesBasicType() { // Arrange var expectedInt = 10; var content = new StreamMessagePackHttpContent(); // Act await _formatter.WriteToStreamAsync(typeof(int), expectedInt, content.Stream, content, _context); // Assert var result = await content.ReadObjectAsync <int>(_serializerOptions); Assert.Equal(expectedInt, result); }