Exemple #1
0
        public async Task DeleteAsync()
        {
            var handler = new RestaurantDataAccess(this.Context, Mapper());
            var entity  = RestaurantTestData.RestaurantDTO;
            await handler.SaveAsync(entity);

            var response = await handler.DeleteAsync(entity.Id);

            Assert.IsTrue(response);
        }
Exemple #2
0
        public async Task SaveAsync()
        {
            var handler = new RestaurantDataAccess(this.Context, Mapper());
            var entity  = RestaurantTestData.RestaurantDTO;
            var result  = await handler.SaveAsync(entity);

            var outcome = result.Id != 0;

            Assert.IsTrue(outcome);
        }
Exemple #3
0
        public async Task GetAsync()
        {
            var handler = new RestaurantDataAccess(this.Context, Mapper(), this.CachingService);
            var entity  = RestaurantTestData.RestaurantDTO;
            await handler.SaveAsync(entity);

            var response = await handler.GetAsync(entity.Id);

            Assert.IsTrue(response != null);
        }
Exemple #4
0
        public async Task GetAllAsync()
        {
            var handler = new RestaurantDataAccess(this.Context, Mapper());
            var entity  = RestaurantTestData.RestaurantDTO;
            await handler.SaveAsync(entity);

            var response = await handler.GetAllAsync(new RestaurantDTO());

            var outcome = response.Count;

            Assert.IsTrue(outcome == 1);
        }
Exemple #5
0
        public async Task UpdateAsync()
        {
            var handler            = new RestaurantDataAccess(this.Context, Mapper());
            var entity             = RestaurantTestData.RestaurantDTO;
            var originalRestaurant = entity;
            await handler.SaveAsync(entity);

            entity.Name = new Faker().Commerce.Department();
            var response = await handler.UpdateAsync(entity);

            var outcome = response.Name.Equals(originalRestaurant.Name);

            Assert.IsTrue(outcome);
        }