public void FindTotalAgeOfAllPeople_Everyone_Returns403() { // Arrange var people = TestData.LotsOfPeople; // Act var totalAge = AdvancedLinq.FindTotalAgeOfAllPeople(people); // Assert totalAge.Should().Be(403); }
public void FindAllFavouriteColours_EmptyList_ReturnsEmptyList() { // Arrange var people = TestData.NoPeople; // Act var result = AdvancedLinq.FindAllFavouriteColours(people); // Assert result.Should().BeEmpty(); }
public void CreateDictionaryOfNameToFavouriteColour_EmptyList_ReturnsEmptyDictionary() { // Arrange var people = TestData.NoPeople; // Act var favouriteColourDictionary = AdvancedLinq.CreateDictionaryOfNameToFavouriteColour(people); // Assert favouriteColourDictionary.Should().BeEmpty(); }
public void FindTotalAgeOfAllPeople_EmptyList_Returns0() { // Arrange var people = TestData.NoPeople; // Act var totalAge = AdvancedLinq.FindTotalAgeOfAllPeople(people); // Assert totalAge.Should().Be(0); }
public void FindTotalAgeOfAllPeople_AbbySmith_Returns29() { // Arrange var people = TestData.AbbySmith; // Act var totalAge = AdvancedLinq.FindTotalAgeOfAllPeople(people); // Assert totalAge.Should().Be(29); }
public void NamesWithOtherNamesIncluded_EmptyList_ReturnsEmptyList() { // Arrange var people = TestData.NoPeople; // Act var result = AdvancedLinq.NamesWithOtherNamesIncluded(people); // Assert result.Should().BeEmpty(); }
public void NamesWithOtherNamesIncluded_AbbySmith_ReturnsAbbySmith() { // Arrange var people = TestData.AbbySmith; // Act var result = AdvancedLinq.NamesWithOtherNamesIncluded(people); // Assert result.Should().Be("Abby, Olivia, Smith\n"); }
public void FindAllFavouriteColours_AllThePeople_ReturnsUniqueColours() { // Arrange var people = TestData.AllThePeople; // Act var result = AdvancedLinq.FindAllFavouriteColours(people); // Assert result.Should().NotBeNull(); }
public void FindFirstNamesWhichExistInBothLists_AbbySmith_EmptyList_ReturnsEmptyList() { // Arrange var people = TestData.AbbySmith; var otherPeople = TestData.NoPeople; // Act var namesWhichExistInBoth = AdvancedLinq.FindFirstNamesWhichExistInBothLists(people, otherPeople); // Assert namesWhichExistInBoth.Should().BeEmpty(); }
public void CreateDictionaryOfNameToFavouriteColour_AbbySmith_ReturnsSingleElementDictionary() { // Arrange var people = TestData.AbbySmith; // Act var favouriteColourDictionary = AdvancedLinq.CreateDictionaryOfNameToFavouriteColour(people); // Assert favouriteColourDictionary.Should().HaveCount(1); favouriteColourDictionary.Should().Contain("Abby", Colour.Blue); }
public void FindAllFavouriteColours_AbbySmith_ReturnsSingleElement() { // Arrange var people = TestData.AbbySmith; // Act var result = AdvancedLinq.FindAllFavouriteColours(people); // Assert var colour = result.Should().ContainSingle().Subject; colour.Should().Be(Colour.Blue); }
public void FindFirstNamesWhichExistInBothLists_AbbySmith_JohnDoe_ReturnsEmptyList() { // Arrange var people = TestData.AbbySmith; var otherPeople = new List <Person> { new Person("John", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion") }; // Act var namesWhichExistInBoth = AdvancedLinq.FindFirstNamesWhichExistInBothLists(people, otherPeople); // Assert namesWhichExistInBoth.Should().BeEmpty(); }
public void FindFirstNamesWhichExistInBothLists_AbbySmith_AbbyDoe_ReturnsAbby() { // Arrange var people = TestData.AbbySmith; var otherPeople = new List <Person> { new Person("Abby", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion") }; // Act var namesWhichExistInBoth = AdvancedLinq.FindFirstNamesWhichExistInBothLists(people, otherPeople); // Assert var name = namesWhichExistInBoth.Should().ContainSingle().Subject; name.Should().Be("Abby"); }
public void FindAllFavouriteColours_Everyone_ReturnsUniqueColours() { // Arrange var people = TestData.LotsOfPeople; // Act var result = AdvancedLinq.FindAllFavouriteColours(people); // Assert result.Should().BeEquivalentTo(new List <Colour> { Colour.Blue, Colour.Orange, Colour.Purple, Colour.Green }); }
public void FindTotalAgeOfAllPeople_Set_ReturnsTotal() { // Arrange var people = new HashSet <Person> { new Person("Array", "Not", new List <string> { "A", "List" }, new DateTime(2000, 1, 1), 20, Colour.Red, "Collections"), new Person("Billy", "Not", new List <string> { "A", "List" }, new DateTime(2000, 1, 1), 30, Colour.Red, "Collections"), new Person("Cherry", "Not", new List <string> { "A", "List" }, new DateTime(2000, 1, 1), 40, Colour.Red, "Collections") }; // Act var totalAge = AdvancedLinq.FindTotalAgeOfAllPeople(people); // Assert totalAge.Should().Be(90); }
public void CreateDictionaryOfNameToFavouriteColour_LotsOfPeople_ReturnsDictionaryWithAllPairs() { // Arrange var people = TestData.LotsOfPeople; // Act var favouriteColourDictionary = AdvancedLinq.CreateDictionaryOfNameToFavouriteColour(people); // Assert favouriteColourDictionary.Should().HaveCount(11); favouriteColourDictionary.Should().Contain("Abby", Colour.Blue); favouriteColourDictionary.Should().Contain("Bob", Colour.Orange); favouriteColourDictionary.Should().Contain("Charlie", Colour.Purple); favouriteColourDictionary.Should().Contain("Dani", Colour.Blue); favouriteColourDictionary.Should().Contain("Ellie", Colour.Blue); favouriteColourDictionary.Should().Contain("Felicity", Colour.Blue); favouriteColourDictionary.Should().Contain("George", Colour.Blue); favouriteColourDictionary.Should().Contain("Hannah", Colour.Blue); favouriteColourDictionary.Should().Contain("Ismail", Colour.Green); favouriteColourDictionary.Should().Contain("Jake", Colour.Blue); favouriteColourDictionary.Should().Contain("Lenny", Colour.Blue); }
public void NamesWithOtherNamesIncluded_LotsOfPeople_ReturnsEveryone() { // Arrange var people = TestData.LotsOfPeople; // Act var result = AdvancedLinq.NamesWithOtherNamesIncluded(people); // Assert result.Should().Be(@"Abby, Olivia, Smith Bob, Humphrey Charlie, Paul Dani, Holmes, Reed, Hayes Ellie, Hunt, Ball Felicity, Plott George, Olivia, Hayes Hannah, Nelson, Hunt, Reed, Baller Ismail, Francis, , Ray Jake, , Smith Lenny, 1231914=9123812=03&&&%%%, Smith "); }
public void FindFirstNamesWhichExistInBothLists_LotsOfPeople_RandomPeople_PeopleWhoExistInBoth() { // Arrange var people = TestData.LotsOfPeople; var otherPeople = new List <Person> { new Person("Zebedee", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion"), new Person("Josh", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion"), new Person("Dani", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion"), new Person("Ismail", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion"), new Person("Jack", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion"), new Person("Daniel", "Doe", null, new DateTime(2000, 1, 1), 10, Colour.Blue, "TransUnion"), }; // Act var namesWhichExistInBoth = AdvancedLinq.FindFirstNamesWhichExistInBothLists(people, otherPeople); // Assert namesWhichExistInBoth.Should().BeEquivalentTo(new List <string> { "Dani", "Ismail" }); }