public ReportServicesTests() { this.db = DbGenerator.GetDbContext(); DbSeeder.SeedNormalUsers(this.db); DbSeeder.SeedGames(this.db); this.reportService = new ReportService(this.db, new GameService(this.db)); }
public static PixelArtWarsDbContext GetDbContext() { var options = new DbContextOptionsBuilder <PixelArtWarsDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var db = new PixelArtWarsDbContext(options); return(db); }
public DrawingServiceTests() { this.db = DbGenerator.GetDbContext(); DbSeeder.SeedNormalUsers(this.db); DbSeeder.SeedGames(this.db); var imageService = new Mock <IImageService>(); imageService .Setup(s => s.SaveGameDrawing(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>())) .Returns(() => Task.FromResult(ImageUrl)); this.drawingService = new DrawingService(this.db, imageService.Object); }
public static void SeedNormalUsers(PixelArtWarsDbContext db) { for (int i = 0; i < 20; i++) { db.Users.Add(new User() { UserName = i.ToString(), Email = $"bistra{i}@basheva.tues", IsBanned = false }); } db.SaveChanges(); }
public static void SeedGames(PixelArtWarsDbContext db) { for (int i = 0; i < 20; i++) { db.Games.Add(new Game() { Theme = $"StellaBasheva{i}", Status = GameStauts.Active, PlayersCount = 2 }); } db.SaveChanges(); }
public DrawingService(PixelArtWarsDbContext db, IImageService imageService) { this.db = db; this.imageService = imageService; }
public GameService(PixelArtWarsDbContext db) { this.db = db; }
public GameServiceTests() { this.db = DbGenerator.GetDbContext(); DbSeeder.SeedNormalUsers(this.db); this.gameService = new GameService(this.db); }
public ReportService(PixelArtWarsDbContext db, IGameService gameService) { this.db = db; this.gameService = gameService; }