public void GetBirdsTest() { var mockRepository = new BirdRepository(); AddBirdTest(); var birdsCollection = mockRepository.GetBirds(); if (birdsCollection == null) { Assert.Fail(); } }
public void PagingAndRepeater(int id) { var repos = new BirdRepository(); IList <Bird> birds = repos.GetBirds(); IPaginatedPage items = PaginationHelper.CreatePagination( birds, // list 10, // number of items per page id ); PropertyBag["items"] = items; }
public void RepositoryTest() { var mockRepository = new BirdRepository(); AddBirdTest(); GetSpecificBirdTest(); RemoveBirdTest(); UpdateBirdTest(); var finalBirdsCollection = mockRepository.GetBirds(); if (finalBirdsCollection == null) { Assert.Fail(); } }
public ActionResult PagingAndRepeater(int?id) { var pageNumber = id ?? 1; var pageSize = 10; var repos = new BirdRepository(); var allBirds = repos.GetBirds(); var showBirds = allBirds.Skip((pageNumber - 1) * pageSize).Take(pageSize); var birdCount = allBirds.Count(); return(View(new Page <Bird> { Items = showBirds, ItemCount = birdCount, CurrentPage = pageNumber, PageCount = (birdCount + pageSize - 1) / pageSize, FirstItemIndex = (pageNumber - 1) * pageSize })); }
public void AddBirdTest() { var mockRepository = new BirdRepository(); mockRepository.AddBird(new Bird { BirdType = BirdType.Archie, Girth = 3.21, Id = 1, Height = 3.3, Length = 4.3, SpecimenName = "Archie", Weight = 45.4, Location = new Location { Altitude = "3453", Latitude = "23423", Longitude = "12341", Name = "Cypress" }, Skeleton = new Skeleton() }); mockRepository.AddBird(new Bird { BirdType = BirdType.Archie, Girth = 1.21, Id = 2, Height = 2.3, Length = 3.3, SpecimenName = "Archie 2", Weight = 15.4, Location = new Location { Altitude = "3453", Latitude = "23423", Longitude = "12341", Name = "Cypress" }, Skeleton = new Skeleton() }); if (mockRepository.GetBirds() == null) { Assert.Fail(); } }