public void Should_be_possible_to_get_an_empty_set_if_an_empty_list_was_informed_for_intersection_operation() { IEnumerable<string> firstReferences = new List<string>() { "10", "20", "40", "60" }; IEnumerable<string> secondReferences = new List<string>(); SetOperation operation = new IntersectionSetOperation(); IEnumerable<string> results = operation.Execute(firstReferences, secondReferences); Assert.AreEqual(0, results.Count()); }
public void Should_be_possible_to_get_an_intersection_between_two_sets() { IEnumerable<string> firstReferences = new List<string>() { "10", "20", "40","60"}; IEnumerable<string> secondReferences = new List<string>() { "20", "60" }; SetOperation operation = new IntersectionSetOperation(); IEnumerable<string> results = operation.Execute(firstReferences, secondReferences); Assert.AreEqual(2, results.Count()); string element = results.Where<string>(item => item == "20").SingleOrDefault(); Assert.IsNotNull(element, "the element expected is not exits"); element = results.Where<string>(item => item == "60").SingleOrDefault(); Assert.IsNotNull(element, "the element expected is not exits"); }
public void Should_be_possible_to_get_an_empty_set_if_not_exists_intersection_between_two_sets() { IEnumerable<string> firstReferences = new List<string>() { "10", "20", "40", "60" }; IEnumerable<string> secondReferences = new List<string>() { "180", "80" }; SetOperation operation = new IntersectionSetOperation(); IEnumerable<string> results = operation.Execute(firstReferences, secondReferences); Assert.AreEqual(0, results.Count()); }