public void MovementLogEmptyTest() { var movementLog = new MovementLog(2); var localServer = EnvironmentGlobal.CreateGameServer("MovementLogTests"); movementLog.Update(localServer.RefreshGameSession()); Assert.IsTrue(movementLog.GetHistoryForCelestialObject(100).Count == 0); }
public static void DrawSpaceShipMovement(Graphics graphics, GameSession gameSession, SortedDictionary <int, GranularObjectInformation> turnMapInformation, int turnStep, MovementLog history, ScreenParameters screenParameters) { foreach (var celestialObject in gameSession.SpaceMap.CelestialObjects.Where(o => screenParameters.PointInVisibleScreen(o.PositionX, o.PositionY))) { var historyMovement = history.GetHistoryForCelestialObject(celestialObject.Id); var granularTurnPositions = turnMapInformation.Values.Where(o => o.Id == celestialObject.Id); DrawTrajectory(graphics, celestialObject, historyMovement, turnMapInformation, turnStep, Color.FromArgb(200, 200, 44), screenParameters); } }
public void UpdateTest() { var movementLog = new MovementLog(4); var localServer = EnvironmentGlobal.CreateGameServer("MovementLogTests"); movementLog.Update(localServer.RefreshGameSession()); Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 2); Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[0].Coordinates, new PointF(8000, 10000)); Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[1].Coordinates, new PointF(10000, 10000)); localServer.TurnCalculation(); movementLog.Update(localServer.RefreshGameSession()); Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 3); Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[0].Coordinates, new PointF(8000, 10000)); Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[1].Coordinates, new PointF(10000, 10000)); Assert.AreEqual(movementLog.GetHistoryForCelestialObject(5005)[2].Coordinates, new PointF(10005, 10000)); localServer.TurnCalculation(); movementLog.Update(localServer.RefreshGameSession()); Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 4); localServer.TurnCalculation(); movementLog.Update(localServer.RefreshGameSession()); Assert.IsTrue(movementLog.GetHistoryForCelestialObject(5005).Count == 4); //Assert.IsTrue(MovementLog.); }