public async Task Read_ShouldDisposeStream( IHttpRequestResult result, DeserializerHttpRequestResultReader sut, MemoryStream stream, object expected) { //arrange //act await sut.Read <object>(result, CancellationToken.None); //assert stream.CanRead.Should().BeFalse(); }
public async Task Read_ShouldReturnCorrectValue( [Frozen]Mock<IDeserializer> deserializer, IHttpRequestResult result, DeserializerHttpRequestResultReader sut, MemoryStream stream, object expected) { //arrange deserializer.Setup(d => d.Deserialize<object>(stream)).Returns(expected); //act var actual = await sut.Read<object>(result, CancellationToken.None); //assert actual.Should().Be(expected); }
public async Task Read_ShouldReturnCorrectValue( [Frozen] Mock <IDeserializer> deserializer, IHttpRequestResult result, DeserializerHttpRequestResultReader sut, MemoryStream stream, object expected) { //arrange deserializer.Setup(d => d.Deserialize <object>(stream)).Returns(expected); //act var actual = await sut.Read <object>(result, CancellationToken.None); //assert actual.Should().Be(expected); }
public async Task Read_WhenExceptionIsThrown_ShouldDisposeStream( [Frozen] Mock <IDeserializer> deserializer, IHttpRequestResult result, DeserializerHttpRequestResultReader sut, MemoryStream stream, object expected) { //arrange deserializer.Setup(d => d.Deserialize <object>(stream)).Throws(new Exception()); //act try { await sut.Read <object>(result, CancellationToken.None); } catch (Exception) { } //assert stream.CanRead.Should().BeFalse(); }
public async Task Read_ShouldDisposeStream( IHttpRequestResult result, DeserializerHttpRequestResultReader sut, MemoryStream stream, object expected) { //arrange //act await sut.Read<object>(result, CancellationToken.None); //assert stream.CanRead.Should().BeFalse(); }
public async Task Read_WhenExceptionIsThrown_ShouldDisposeStream( [Frozen]Mock<IDeserializer> deserializer, IHttpRequestResult result, DeserializerHttpRequestResultReader sut, MemoryStream stream, object expected) { //arrange deserializer.Setup(d => d.Deserialize<object>(stream)).Throws(new Exception()); //act try { await sut.Read<object>(result, CancellationToken.None); } catch (Exception) { } //assert stream.CanRead.Should().BeFalse(); }