示例#1
0
        public void CPUList_ReturnCPUListWithPagingInfo_ReturnRightCountOfList()
        {
            //Arrange
            ShowService service =
                new ShowService(
                    uow.Object,
                    CPUs.Object,
                    GPUs.Object,
                    Games.Object,
                    Mapper);
            var cpuList = new List <CPU>();

            for (var i = 0; i < 16; i++)
            {
                cpuList.Add(
                    new CPU {
                    ProductGuid = Guid.NewGuid(), ProcessorNumber = i.ToString()
                });
            }

            CPUs.Setup(x => x.Get()).Returns(cpuList.AsQueryable());
            //Act
            var result = service.ListCPU(2);

            //Assert
            Assert.AreEqual(6, result.CPUList.Count());
        }
示例#2
0
        public void CPUList_ReturnCPUListWhenQuanityMoreThanPageSize_RightReturn()
        {
            //Arrange
            ShowService service =
                new ShowService(
                    uow.Object,
                    CPUs.Object,
                    GPUs.Object,
                    Games.Object,
                    Mapper);
            var cpuList = new List <CPU>();

            for (var i = 0; i < 16; i++)
            {
                cpuList.Add(
                    new CPU {
                    ProductGuid     = Guid.NewGuid(),
                    ProcessorNumber = i.ToString()
                });
            }
            var f = cpuList.Take(100);

            CPUs.Setup(x => x.Get()).Returns(cpuList.AsQueryable());
            //Act
            var result = service.ListCPU(2);

            //Assert
            Assert.AreEqual(6, result.CPUList.Count());
        }