示例#1
0
        public async Task AddGroupAsyncWithCorrectDataShouldAddGroupToConcert()
        {
            MapperInitializer.InitializeMapper();
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;
            var dbContext  = new ApplicationDbContext(options);
            var cloudinary = new Mock <ICloudinaryService>();
            var concertGroupsRepository = new EfRepository <ConcertGroup>(dbContext);
            var groupsRepository        = new EfDeletableEntityRepository <Group>(dbContext);
            var groupGenresRepository   = new EfRepository <GroupGenre>(dbContext);
            var usertGroupsRepository   = new EfRepository <UserGroup>(dbContext);
            var groupService            = new GroupsService(concertGroupsRepository, groupsRepository, groupGenresRepository, usertGroupsRepository, cloudinary.Object);

            await groupService.AddGroupAsync(1, 1);

            Assert.Equal(1, await concertGroupsRepository.All().CountAsync());
        }