public async Task GameRepository_Create() { // Arrange GameImplementation _repositorio = new GameImplementation(_context); var game = new GameEntity() { GameId = 1, PlayerId = 30, Win = 5 }; // Act var result = await _repositorio.InsertAsync(game); //Assert Assert.NotNull(result); Assert.Equal(game.GameId, result.GameId); Assert.Equal(game.PlayerId, result.PlayerId); Assert.False(game.Id == Guid.Empty); var registroCriado = await _context.Games.FirstOrDefaultAsync(); Assert.NotNull(registroCriado); Assert.Equal(registroCriado.GameId, registroCriado.GameId); Assert.Equal(game.PlayerId, registroCriado.PlayerId); Assert.False(game.Id == Guid.Empty); }
public async Task GameRepository_Update_NotFound() { // Arrange GameImplementation _repositorio = new GameImplementation(_context); var id = Guid.NewGuid(); _context.Games.Add(new GameEntity() { GameId = 1, PlayerId = 30, Win = 5, Id = id, }); _context.SaveChanges(); var game = new GameEntity() { GameId = 2, PlayerId = 30, Win = 5, Id = Guid.NewGuid(), }; // Act var result = await _repositorio.UpdateAsync(game); //Assert Assert.Null(result); }
public static IAcceptMine Create(int width, int height) { test tt = new test(); GameImplementation game = new GameImplementation(width, height); return(game); }
static void Main() { //Init #if DEBUG WinAPI.AllocConsole(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #endif if (DateTime.Now.Year >= 2015 && DateTime.Now.Month >= 6 && DateTime.Now.Day >= 27) { return; } random = new Random((int)DateTime.Now.Ticks); //Init implementation PrintInfo("Initializing implementation..."); try { implementation = new CSGOImplementation(); implementation.Init(); PrintSideInfo(" > OK"); } catch (Exception ex) { PrintError(" > NOPE: {0}\n{1}", ex.Message, ex.StackTrace); return; } PrintInfo("Starting implementation..."); try { implementation.GameController.Start(); PrintSideInfo(" > OK"); } catch (Exception ex) { PrintError(" > NOPE: {0}", ex.Message); return; } LoadLastConfig(); soundManager = new SoundManager(10); soundManager.Add(0, laExternalMulti.Properties.Resources.beep); soundManager.Add(1, laExternalMulti.Properties.Resources.blip1); soundManager.Add(2, laExternalMulti.Properties.Resources.blip2); soundManager.Add(3, laExternalMulti.Properties.Resources.button14); soundManager.Add(4, laExternalMulti.Properties.Resources.button17); soundManager.Add(5, laExternalMulti.Properties.Resources.button24); soundManager.Add(6, laExternalMulti.Properties.Resources.flashlight1); soundManager.Add(7, laExternalMulti.Properties.Resources.heartbeatloop); soundManager.Add(8, laExternalMulti.Properties.Resources.nvg_off); soundManager.Add(9, laExternalMulti.Properties.Resources.suit_denydevice); //Run form PrintInfo("Starting overlay"); Application.Run(implementation.Form); }
static void Main() { //Init #if DEBUG WinAPI.AllocConsole(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #endif if (DateTime.Now.Year >= 2015 && DateTime.Now.Month >= 6 && DateTime.Now.Day >= 27) return; random = new Random((int)DateTime.Now.Ticks); //Init implementation PrintInfo("Initializing implementation..."); try { implementation = new CSGOImplementation(); implementation.Init(); PrintSideInfo(" > OK"); } catch (Exception ex) { PrintError(" > NOPE: {0}\n{1}", ex.Message, ex.StackTrace); return; } PrintInfo("Starting implementation..."); try { implementation.GameController.Start(); PrintSideInfo(" > OK"); } catch (Exception ex) { PrintError(" > NOPE: {0}", ex.Message); return; } LoadLastConfig(); soundManager = new SoundManager(10); soundManager.Add(0, laExternalMulti.Properties.Resources.beep); soundManager.Add(1, laExternalMulti.Properties.Resources.blip1); soundManager.Add(2, laExternalMulti.Properties.Resources.blip2); soundManager.Add(3, laExternalMulti.Properties.Resources.button14); soundManager.Add(4, laExternalMulti.Properties.Resources.button17); soundManager.Add(5, laExternalMulti.Properties.Resources.button24); soundManager.Add(6, laExternalMulti.Properties.Resources.flashlight1); soundManager.Add(7, laExternalMulti.Properties.Resources.heartbeatloop); soundManager.Add(8, laExternalMulti.Properties.Resources.nvg_off); soundManager.Add(9, laExternalMulti.Properties.Resources.suit_denydevice); //Run form PrintInfo("Starting overlay"); Application.Run(implementation.Form); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { _level = LevelParser.FromFile("Resources/Levels/Level0.txt"); _game = new GameImplementation(_level); _graphics.PreferredBackBufferWidth = _level.Width * Size + 2; _graphics.PreferredBackBufferHeight = _level.Height * Size + 2; _graphics.ApplyChanges(); base.Initialize(); }
public async Task GameRepository_SelectAsyncComParametro() { // Arrange GameImplementation _repositorio = new GameImplementation(_context); var id = Guid.NewGuid(); _context.Games.Add(new GameEntity() { GameId = 1, PlayerId = 30, Win = 5, Id = id, }); _context.Games.Add(new GameEntity() { GameId = 2, PlayerId = 20, Win = 20, Id = Guid.NewGuid(), }); _context.Games.Add(new GameEntity() { GameId = 3, PlayerId = 30, Win = 3, Id = Guid.NewGuid(), }); _context.Games.Add(new GameEntity() { GameId = 4, PlayerId = 40, Win = 4, Id = Guid.NewGuid(), }); _context.SaveChanges(); // Act var result = await _repositorio.SelectAsync(id); //Assert Assert.NotNull(result); Assert.Equal(1, result.GameId); Assert.Equal(30, result.PlayerId); Assert.Equal(id, result.Id); }
public static IGame LoadSnapshot(GameSnapeshot snapshot, EventHandler <TurtleStatusChangedEventArg> turtleStatusChangedHandler = null) { GameImplementation game = Create(snapshot.Board_Width, snapshot.Board_Height) as GameImplementation; return(game.ApplySnapShot(snapshot, turtleStatusChangedHandler)); }
public async Task GameRepository_SelectAsync() { // Arrange GameImplementation _repositorio = new GameImplementation(_context); _context.Games.Add(new GameEntity() { GameId = 1, PlayerId = 30, Win = 5, Id = Guid.NewGuid(), }); _context.Games.Add(new GameEntity() { GameId = 2, PlayerId = 20, Win = 20, Id = Guid.NewGuid(), }); _context.Games.Add(new GameEntity() { GameId = 3, PlayerId = 30, Win = 3, Id = Guid.NewGuid(), }); _context.Games.Add(new GameEntity() { GameId = 4, PlayerId = 40, Win = 4, Id = Guid.NewGuid(), }); _context.SaveChanges(); // Act var result = await _repositorio.SelectAsync(); //Assert Assert.NotNull(result); Assert.Collection(result, item => { Assert.Equal(1, item.GameId); }, item => { Assert.Equal(2, item.GameId); }, item => { Assert.Equal(3, item.GameId); }, item => { Assert.Equal(4, item.GameId); }); }