public void Enumerable_ShouldBe_SourceItems_WithError_WhenSkipped() { // Arrange var existing = new List <Attachment> { new Attachment("A") }; var source = new[] { new Attachment("B"), new Attachment("C"), new Attachment("D") }; var expected = new[] { new Attachment("D") }; var filter = new TooManyAttachmentFilter(existing, 3, source); // Act var result = new List <Attachment>(); foreach (var item in filter) { existing.Add(item); result.Add(item); } // Assert result.TooMany().Should().BeEquivalentTo(expected); }
public void Enumerable_ShouldBeEmpty_WhenSource_IsEmpty() { // Arrange var existing = new[] { new Attachment("A"), new Attachment("B"), new Attachment("C") }; var source = Enumerable.Empty <Attachment>(); var filter = new TooManyAttachmentFilter(existing, 3, source); // Act var result = filter.ToList(); // Assert result.Should().BeEmpty(); }
public void Enumerable_ShouldBe_SourceItems_WithError_Skipped() { // Arrange var existing = new[] { new Attachment("A"), new Attachment("B"), new Attachment("C") }; var source = new[] { new Attachment("D"), new Attachment("E") }; var filter = new TooManyAttachmentFilter(existing, 3, source); // Act var result = filter.ToList(); // Assert result.TooMany().Should().BeEquivalentTo(source); }