示例#1
0
        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);
        }
示例#2
0
        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());
        }
示例#3
0
        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);
        }
示例#4
0
        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());
        }
示例#5
0
        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);
        }