public void RemoveAdvertisement_WithAnAdvertisementInTheAdvertisementsCollection_RemovesThatAdvertisementFromTheCollection () { // Arrange var paper = new Newspaper(); var ad1 = new Advertisement { Name = "Test Ad 1 Name", Text = "Test Ad 1 Text" }; var ad2 = new Advertisement { Name = "Test Ad 2 Name", Text = "Test Ad 2 Text" }; paper.AddAdvertisement(ad1); paper.AddAdvertisement(ad2); // act paper.RemoveAdvertisement(ad2); // Assert paper.Advertisements.Should().BeEquivalentTo(new List <Advertisement> { ad1 }, "Removing the second added Ad results in only the first being left."); }
public void RemoveAdvertisement_WithANullAdvertisement_DoesNotChangeTheAdvertisementsConnection() { // Arrange var paper = new Newspaper(); var ad1 = new Advertisement { Name = "Test Ad 1 Name", Text = "Test Ad 1 Text" }; var ad2 = new Advertisement { Name = "Test Ad 2 Name", Text = "Test Ad 2 Text" }; paper.AddAdvertisement(ad1); paper.AddAdvertisement(ad2); // act paper.RemoveAdvertisement(null); // Assert paper.Advertisements.Should().BeEquivalentTo(new List <Advertisement> { ad1, ad2 }, "Removing a null item results in nothing being removed."); }