public async Task ReadAsync_WithOneValidatorReturningFailed_ThrowsExceptionAsync() { var testee = new TesteeBuilder() .WithEmptyHeader() .WithEmptyContent() .WithOneHeaderValidatorReturningFailure("whatever") .Build(); Func <Task> action = async() => await testee.ReadAsync(new MemoryStream()); action.Should().Throw <InvalidDataException>("Validation failed for the header of the fits file: whatever"); }
public async Task ReadAsync_WithOneValidatorReturningSuccess_ReturnsParsedFileAsync() { var testee = new TesteeBuilder() .WithEmptyHeader() .WithEmptyContent() .WithOneHeaderValidatorReturningSuccess() .Build(); var actual = await testee.ReadAsync(new MemoryStream()); actual.Should().NotBeNull(); }
public async Task ReadAsync_WithDeserializerThrowingException_ThrowsException() { var testee = new TesteeBuilder() .WithEmptyHeader() .WithEmptyContent() .WithOneHeaderValidatorReturningSuccess() .WithDeserializerThrowingException() .Build(); Func <Task> action = async() => await testee.ReadAsync(new MemoryStream()); action.Should().Throw <Exception>(); }