コード例 #1
0
        public object GetAll()
        {
            var petsService = new PetsService();
            var result      = petsService.GetAll(_petsDbContext);

            return(result);
        }
コード例 #2
0
        public async Task MethodShoudReturnAllPets()
        {
            var list     = new List <Pet>();
            var mockRepo = new Mock <IDeletableEntityRepository <Pet> >();

            mockRepo.Setup(x => x.AllAsNoTracking()).Returns(list.AsQueryable());

            var service   = new PetsService(mockRepo.Object);
            var viewModel = new PetsInListViewModel
            {
                AddedByUserId = "PeshoId",
                BreedId       = 1,
                CityId        = 1,
                DateOfBirth   = new DateTime(2008, 3, 1, 7, 0, 0),
                Id            = 1,
                Name          = "PeshoCat",
            };
            var pet = new Pet
            {
                AddedByUserId = "PeshoId",
                BreedId       = 1,
                CityId        = 1,
                DateOfBirth   = new DateTime(2008, 3, 1, 7, 0, 0),
                Id            = 1,
                Name          = "PeshoCat",
            };

            list.Add(pet);
            service.GetAll <PetsInListViewModel>(1);
        }