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); }
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); }