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); }
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); }
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(); }
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(""); }
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); }