public void Test_ListJoiner_FirstList_is_SHORTER_Than_SecondList() { //Given var firstList = new List <ProductQuantity> { new ProductQuantity("car", 3), new ProductQuantity("phone", 2), }; var secondList = new List <ProductQuantity> { new ProductQuantity("car", 4), new ProductQuantity("car", 4), new ProductQuantity("bike", 4), new ProductQuantity("phone", 2) }; //When var joiner = new ListJoiner(firstList, secondList); var joinedList = joiner.MergeLists(); //Then Assert.Equal(new[] { new ProductQuantity("car", 11), new ProductQuantity("phone", 4), new ProductQuantity("bike", 4) } , joinedList); }
public void Test_ListJoiner_Lists_Have_No_common_Elements() { //Given var firstList = new List <ProductQuantity> { new ProductQuantity("car", 3), new ProductQuantity("phone", 2), }; var secondList = new List <ProductQuantity> { new ProductQuantity("bike", 4), new ProductQuantity("motorcycle", 2) }; //When var joiner = new ListJoiner(firstList, secondList); var joinedList = joiner.MergeLists(); //Then Assert.Equal(new[] { new ProductQuantity("car", 3), new ProductQuantity("phone", 2), new ProductQuantity("bike", 4), new ProductQuantity("motorcycle", 2), } , joinedList); }
public void Test_ListJoiner_lists_contain_More_Elements() { //Given var firstList = new List <ProductQuantity> { new ProductQuantity("car", 3), new ProductQuantity("bike", 4) }; var secondList = new List <ProductQuantity> { new ProductQuantity("car", 4), new ProductQuantity("bike", 4) }; //When var joiner = new ListJoiner(firstList, secondList); //Then Assert.Equal(new[] { new ProductQuantity("car", 7), new ProductQuantity("bike", 8) } , joiner.MergeLists()); }
public void Test_ListJoiner_Same_Product_May_Appear_more_Times_in_FirstList() { //Given var firstList = new List <ProductQuantity> { new ProductQuantity("car", 3), new ProductQuantity("car", 4), new ProductQuantity("bike", 4) }; var secondList = new List <ProductQuantity> { new ProductQuantity("car", 4), new ProductQuantity("bike", 4) }; //When var joiner = new ListJoiner(firstList, secondList); var joinedList = joiner.MergeLists(); //Then Assert.Equal(new[] { new ProductQuantity("car", 11), new ProductQuantity("bike", 8) } , joinedList); }
public void Union_1stListNull() { // Arrange List <string> expected = TestList2; // Act List <string> actual = ListJoiner.Union(null, TestList2); // Assert Assert.Equal(expected, actual); }
public void Union_2ndListNull() { // Arrange List <string> expected = TestList1; // Act List <string> actual = ListJoiner.Union(TestList1, null); // Assert Assert.Equal(expected, actual); }
public void Union_BothListBlank() { // Arrange List <string> expected = new List <string>(); // Act List <string> actual = ListJoiner.Union(new List <string>(), new List <string>()); // Assert Assert.Equal(expected, actual); }
public void Union_2ListsUnion() { // Arrange List <string> expected = ExpectedList; // Act List <string> actual = ListJoiner.Union(TestList1, TestList2); // Assert Assert.Equal(expected, actual); }
public void Test_ListJoiner_Simple_Lists() { //Given var firstList = new List <ProductQuantity> { new ProductQuantity("car", 3) }; var secondList = new List <ProductQuantity> { new ProductQuantity("car", 4) }; //When var joiner = new ListJoiner(firstList, secondList); //Then Assert.Equal(new[] { new ProductQuantity("car", 7) } , joiner.MergeLists()); }