Ejemplo n.º 1
0
        public async Task GetById_WithInvalidInput_ShouldReturnInvalidResult(int id)
        {
            var dbContext = ApplicationDbContextCreatorInMemory.InitializeContext();

            await this.SeedData(dbContext);

            var actorsRepository = new EfDeletableEntityRepository <Actor>(dbContext);

            var service = new ActorsService(actorsRepository);

            Assert.Null(service.GetById <ActorViewModel>(id));
        }
Ejemplo n.º 2
0
        public async Task Delete_WithValidInput_ShouldReturnValidResult()
        {
            var dbContext = ApplicationDbContextCreatorInMemory.InitializeContext();

            await this.SeedData(dbContext);

            var actorsRepository = new EfDeletableEntityRepository <Actor>(dbContext);
            var service          = new ActorsService(actorsRepository);

            var actor = service.GetById <ActorEditModel>(1);

            var result = service.Delete(actor);

            Assert.Equal(1, dbContext.Actors.Count());
        }