コード例 #1
0
        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");
        }
コード例 #2
0
        public async Task ReadAsync_WithOneValidatorReturningSuccess_ReturnsParsedFileAsync()
        {
            var testee = new TesteeBuilder()
                         .WithEmptyHeader()
                         .WithEmptyContent()
                         .WithOneHeaderValidatorReturningSuccess()
                         .Build();

            var actual = await testee.ReadAsync(new MemoryStream());

            actual.Should().NotBeNull();
        }
コード例 #3
0
        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>();
        }