示例#1
0
        public void Attachment_ErrorType_ShouldBe_FileReadError_WhenFileDoesNotExist()
        {
            // Arrange
            var source = new[] { new Attachment("Not existing\\no file.rrr") };
            var filter = new FileLengthAttachmentFilter(_logger, source);
            // Act
            var result = filter.ToList();

            // Assert
            result.First().ErrorType.Should().Be(AttachmentErrorType.FileReadError);
        }
示例#2
0
        public void Attachment_Length_ShouldBe_FileSize()
        {
            // Arrange
            var source = new[] { new Attachment("TestData\\test.txt") };
            var filter = new FileLengthAttachmentFilter(_logger, source);
            // Act
            var result = filter.ToList();

            // Assert
            result.First().Length.Should().Be(7);
        }
示例#3
0
        public void Enumerable_ShouldBe_Empty_WhenSource_IsEmpty()
        {
            // Arrange
            var source = Enumerable.Empty <Attachment>();
            var filter = new FileLengthAttachmentFilter(_logger, source);
            // Act
            var result = filter.ToList();

            // Assert
            result.Should().BeEmpty();
        }
示例#4
0
        public void Enumerable_ShouldLog_WhenFileDoesNotExist()
        {
            // Arrange
            var source = new[] { new Attachment("Not existing\\no file.rrr") };
            var filter = new FileLengthAttachmentFilter(_logger, source);

            // Act
            filter.ToList();
            // Assert
            _logger.ReceivedWithAnyArgs().Warn("");
        }
示例#5
0
        public void Enumerable_ShouldBe_Attachments_FromSource()
        {
            // Arrange
            var source = new[]
            {
                new Attachment("TestData\\test.txt"),
                new Attachment("TestData\\test-2.txt"),
                new Attachment("TestData\\test-3.txt")
            };
            var filter = new FileLengthAttachmentFilter(_logger, source);
            // Act
            var result = filter.ToList();

            // Assert
            result.Should().BeEquivalentTo(source);
        }