예제 #1
0
 public void WhenAthleteHasNoShoesShouldReturnEmptyList()
 {
     var athlete = new AthleteBuilder().Build();
     var shoeController = new ShoeDataAccess();
     var shoes = shoeController.GetShoes(athlete);
     Assert.AreEqual(0, shoes.Count);
 }
예제 #2
0
 public void WhenAthleteIsNullShouldThrowNullReferenceException()
 {
     try
     {
         var shoePage = new ShoePage();
         var shoeController = new ShoeDataAccess();
         var page = shoeController.GetShoePage(shoePage);
         Assert.Fail("NullReferenceException");
     }
     catch (NullReferenceException)
     {
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }