public async Task GetAllShouldReturnCorrectData() { var repository = new EfDeletableEntityRepository <Hall>(new ApplicationDbContext(this.options.Options)); var service = new HallsService(repository); await service.AddAsync(this.hall); await service.AddAsync(this.hall); var result = service.GetAll <TestHallViewModel>(); Assert.Equal(2, result.Count()); Assert.Equal(ProjectionType.TwoD, result.FirstOrDefault().ProjectionType); }
public async Task AddHallShouldAddCorrectCount() { var repository = new EfDeletableEntityRepository <Hall>(new ApplicationDbContext(this.options.Options)); var service = new HallsService(repository); await service.AddAsync(this.hall); Assert.Equal(1, repository.All().Count()); }
public async Task GetByIdShouldReturnCorrectData() { var repository = new EfDeletableEntityRepository <Hall>(new ApplicationDbContext(this.options.Options)); var service = new HallsService(repository); var diffHall = new AddHallInputModel { ProjectionType = "FourDx", Seats = 100, }; await service.AddAsync(this.hall); await service.AddAsync(diffHall); var result = service.GetById <TestHallViewModel>(2); Assert.Equal(ProjectionType.FourDx, result.ProjectionType); }
public async Task AddHallShouldAddCorrectData() { var repository = new EfDeletableEntityRepository <Hall>(new ApplicationDbContext(this.options.Options)); var service = new HallsService(repository); await service.AddAsync(this.hall); var dbHall = await repository.GetByIdWithDeletedAsync(1); Assert.Equal(ProjectionType.TwoD, dbHall.ProjectionType); Assert.Equal(50, dbHall.Seats.Count()); }
public async Task DeleteHallShouldWorkCorrectly() { var repository = new EfDeletableEntityRepository <Hall>(new ApplicationDbContext(this.options.Options)); var service = new HallsService(repository); await service.AddAsync(this.hall); await service.DeleteAsync(1); var dbHall = await repository.GetByIdWithDeletedAsync(1); Assert.True(dbHall.IsDeleted); }