private static void BasicLinqExample() { var basicLinq = new BasicLinq(); basicLinq.Run(); Console.ReadKey(); }
public void IncludePersonWithNameAbby_EmptyList_ReturnsFalse() { // Arrange var people = TestData.NoPeople; //Act var includesPerson = BasicLinq.IncludesPersonWithName(people, "Abby"); //Assert includesPerson.Should().BeFalse(); }
public void FindOldestPerson_LotsOfPeople_ReturnsFelicityPlott() { // Arrange var people = TestData.LotsOfPeople; //Act var oldestPerson = BasicLinq.FindOldestPerson(people); //Assert oldestPerson.Should().BeEquivalentTo(new Person("Felicity", "Plott", new List <string>(), new DateTime(1800, 4, 5), 99, Colour.Blue, "London")); }
public void FindOldestPerson_AllThePeople_ReturnsPerson() { // Arrange var people = TestData.AllThePeople; //Act var oldestPerson = BasicLinq.FindOldestPerson(people); //Assert oldestPerson.Should().NotBeNull(); }
public void GetFirstNamesOfPeople_SinglePerson_ReturnsListWithSingleName() { // Arrange var people = TestData.AbbySmith; //Act var names = BasicLinq.GetFirstNamesOfPeople(people); //Assert names.Should().ContainSingle().Subject.Should().Be("Abby"); }
public void IncludePersonWithNameBob_AbbySmith_ReturnsTrue() { // Arrange var people = TestData.AbbySmith; //Act var includesPerson = BasicLinq.IncludesPersonWithName(people, "Bob"); //Assert includesPerson.Should().BeFalse(); }
public void GetFirstNamesOfPeople_EmptyList_ReturnsEmptyList() { // Arrange var people = TestData.NoPeople; //Act var names = BasicLinq.GetFirstNamesOfPeople(people); //Assert names.Should().BeEmpty(); }
public void IncludePersonWithNameFelicity_LotsOfPeople_ReturnsTrue() { // Arrange var people = TestData.LotsOfPeople; //Act var includesPerson = BasicLinq.IncludesPersonWithName(people, "Felicity"); //Assert includesPerson.Should().BeTrue(); }
public void IncludePersonWithNameEll_LotsOfPeople_ReturnsFalse() { // Arrange var people = TestData.LotsOfPeople; //Act var includesPerson = BasicLinq.IncludesPersonWithName(people, "Ell"); //Assert includesPerson.Should().BeFalse(); }
public void OrderByAgeDescending_EmptyList_ReturnsEmptyList() { // Arrange var people = TestData.NoPeople; //Act var orderedPeople = BasicLinq.OrderByAgeDescending(people); //Assert orderedPeople.Should().BeEmpty(); }
public void FindOldestPerson_EmptyList_ReturnsNull() { // Arrange var people = TestData.NoPeople; //Act var oldestPerson = BasicLinq.FindOldestPerson(people); //Assert oldestPerson.Should().BeNull(); }
public void GetPeopleOlderThan30_AbbySmith_ReturnsEmptyList() { // Arrange var people = TestData.AbbySmith; const int cutOffAge = 30; //Act var peopleOlderThanCutOffAge = BasicLinq.GetPeopleOlderThan(people, cutOffAge); //Assert peopleOlderThanCutOffAge.Should().BeEmpty(); }
public void GetPeopleOlderThan10_EmptyList_ReturnsEmptyList() { // Arrange var people = TestData.NoPeople; const int cutOffAge = 10; //Act var peopleOlderThanCutOffAge = BasicLinq.GetPeopleOlderThan(people, cutOffAge); //Assert peopleOlderThanCutOffAge.Should().BeEmpty(); }
public void FindOldestPerson_AbbySmith_ReturnsAbbySmith() { // Arrange var people = TestData.AbbySmith; //Act var oldestPerson = BasicLinq.FindOldestPerson(people); //Assert oldestPerson.Should().BeEquivalentTo(new Person("Abby", "Smith", new List <string> { "Olivia" }, new DateTime(1990, 1, 5), 29, Colour.Blue, "Leeds")); }
public void OrderByAgeAscending_AbbySmith_ReturnsAbbySmith() { // Arrange var people = TestData.AbbySmith; //Act var orderedPeople = BasicLinq.OrderByAgeAscending(people); //Assert orderedPeople.Should().BeInAscendingOrder(person => person.Age); orderedPeople.Should().HaveCount(people.Count); //Equivalent to ignores order orderedPeople.Should().BeEquivalentTo(people); }
public void OrderByAgeDescending_LotsOfPeople_ReturnsOrderedList() { // Arrange var people = TestData.LotsOfPeople; //Act var orderedPeople = BasicLinq.OrderByAgeDescending(people); //Assert orderedPeople.Should().BeInDescendingOrder(person => person.Age); orderedPeople.Should().HaveCount(people.Count); //Equivalent to ignores order orderedPeople.Should().BeEquivalentTo(people); }
public void GetPeopleOlderThan29_AbbySmith_ReturnsAbbySmith() { // Arrange var people = TestData.AbbySmith; const int cutOffAge = 29; //Act var peopleOlderThanCutOffAge = BasicLinq.GetPeopleOlderThan(people, cutOffAge); //Assert var person = peopleOlderThanCutOffAge.Should().ContainSingle().Subject; person.FirstName.Should().Be("Abby"); person.LastName.Should().Be("Smith"); }
public void GetPeopleOlderThan18_LotsOfPeople_ReturnsPeopleOlderThan18() { // Arrange var people = TestData.LotsOfPeople; const int cutOffAge = 18; //Act var peopleOlderThanCutOffAge = BasicLinq.GetPeopleOlderThan(people, cutOffAge); //Assert peopleOlderThanCutOffAge.Should().HaveCount(8); peopleOlderThanCutOffAge.Should().BeEquivalentTo(new List <Person> { new Person("Abby", "Smith", new List <string> { "Olivia" }, new DateTime(1990, 1, 5), 29, Colour.Blue, "Leeds"), new Person("Dani", "Hayes", new List <string> { "Holmes", "Reed" }, new DateTime(1986, 6, 5), 55, Colour.Blue, "Sheffield"), new Person("Ellie", "Ball", new List <string> { "Hunt" }, new DateTime(1975, 7, 5), 37, Colour.Blue, "Leeds"), new Person("Felicity", "Plott", new List <string>(), new DateTime(1800, 4, 5), 99, Colour.Blue, "London"), new Person("George", "Hayes", new List <string> { "Olivia" }, new DateTime(1925, 10, 5), 74, Colour.Blue, "Leeds"), new Person("Ismail", "Ray", new List <string> { "Francis", null }, new DateTime(2200, 9, 5), 46, Colour.Green, "Leeds"), new Person("Jake", "Smith", new List <string> { "\n" }, new DateTime(1995, 3, 5), 18, Colour.Blue, "Nowhere"), new Person("Lenny", "Smith", new List <string> { "1231914=9123812=03&&&%%%" }, new DateTime(1990, 1, 5), 18, Colour.Blue, "Leeds") }); }
public void GetFirstNamesOfPeople_LotsOfPeople_ReturnsListWithAllNames() { // Arrange var people = TestData.LotsOfPeople; //Act var names = BasicLinq.GetFirstNamesOfPeople(people); //Assert names.Should().BeEquivalentTo(new List <string> { "Abby", "Bob", "Charlie", "Dani", "Ellie", "Felicity", "George", "Hannah", "Ismail", "Jake", "Lenny" }); }