public void WhenAthleteHasNoShoesShouldReturnEmptyList() { var athlete = new AthleteBuilder().Build(); var shoeController = new ShoeDataAccess(); var shoes = shoeController.GetShoes(athlete); Assert.AreEqual(0, shoes.Count); }
public void WhenAthleteIsNullShouldThrowNullReferenceException() { try { var shoePage = new ShoePage(); var shoeController = new ShoeDataAccess(); var page = shoeController.GetShoePage(shoePage); Assert.Fail("NullReferenceException"); } catch (NullReferenceException) { } }
public void WhenAthleteHasNoShoesShouldReturnPageWithEmptyList() { MemoryDataContext.Clear(); var athlete = BuildAthlete(); var shoePage = new ShoePage { Active = true, Athlete = athlete, RequestsLastPage = false, Shoes = null, Start = 0 }; var shoeController = new ShoeDataAccess(); var page = shoeController.GetShoePage(shoePage); Assert.AreEqual(0, page.Shoes.Count); }
public void WhenPageSizeIs5ShouldReturnPageWith5Shoes() { MemoryDataContext.Clear(); var athlete = BuildAthlete(); BuildAndInsert10ActiveShoes(athlete); var shoePage = new ShoePage { Active = true, Athlete = athlete, RequestsLastPage = false, Shoes = null, Start = 0, PageSize = 5 }; var shoeController = new ShoeDataAccess(); var page = shoeController.GetShoePage(shoePage); Assert.AreEqual(5, page.Shoes.Count); }
public void WhenShoesAreInActiveShouldReturnPageWithActiveShoes() { MemoryDataContext.Clear(); var athlete = BuildAthlete(); BuildAndInsert10ActiveShoes(athlete); Set6ShoesInactive(MemoryDataContext.Queryable<Shoe>()); var shoePage = new ShoePage { Active = true, Athlete = athlete, RequestsLastPage = false, Shoes = null, Start = 0, PageSize = int.MaxValue }; var shoeController = new ShoeDataAccess(); var page = shoeController.GetShoePage(shoePage); Assert.AreEqual(4, page.Shoes.Count); }