Ejemplo n.º 1
0
        public void GetBirdsTest()
        {
            var mockRepository = new BirdRepository();

            AddBirdTest();
            var birdsCollection = mockRepository.GetBirds();

            if (birdsCollection == null)
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public void RepositoryTest()
        {
            var mockRepository = new BirdRepository();

            AddBirdTest();
            GetSpecificBirdTest();
            RemoveBirdTest();
            UpdateBirdTest();
            var finalBirdsCollection = mockRepository.GetBirds();

            if (finalBirdsCollection == null)
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 4
0
        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
            }));
        }
Ejemplo n.º 5
0
        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();
            }
        }