Exemplo n.º 1
0
        public async Task DoesGameExistShouldReturnFalse()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var context = new ApplicationDbContext(options.Options);

            var repository = new EfRepository <Game>(context);
            var service    = new GamesService(repository);
            var model      = new SuggestionToGameViewModel()
            {
                Title       = "test",
                Description = "test",
                ImageUrl    = "test",
            };

            await service.AddAsync(model);

            var actual = await service.DoesGameExist("hahahaaa");

            Assert.False(actual);
        }
Exemplo n.º 2
0
        public async Task AddOnGameShouldAdd()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var context = new ApplicationDbContext(options.Options);

            var repository = new EfRepository <Game>(context);
            var service    = new GamesService(repository);
            var model      = new SuggestionToGameViewModel()
            {
                Title       = "test",
                Description = "test",
                ImageUrl    = "test",
            };

            await service.AddAsync(model);

            var actual = await service.GetAll <GamesDropDownViewModel>();

            Assert.Single(actual);
        }