Esempio n. 1
0
        public void Reloading_MicroWarpDrive_Test()
        {
            var server = EnvironmentGlobal.CreateGameServer("Reloading");

            var gameSession = EnvironmentGlobal.GetSession(server);

            var spaceship = gameSession.GetPlayerSpaceShip();

            var module = spaceship.GetPropulsionModules().First();

            Assert.AreEqual(2.0f, module.Reloading);

            server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Braking));

            Assert.AreEqual(1, server.Commands.Count);

            Assert.AreEqual(7, gameSession.GetCelestialObject(spaceship.Id).Speed);

            server.TurnCalculation(1);

            gameSession = EnvironmentGlobal.GetSession(server);

            spaceship = gameSession.GetPlayerSpaceShip();

            module = spaceship.GetPropulsionModules().First();

            Assert.AreEqual(0.05, module.Reloading);

            server.TurnCalculation(5);

            module = EnvironmentGlobal.GetSessionServerSide(server).GetPlayerSpaceShip().GetPropulsionModules().First();

            Assert.AreEqual(0.3, module.Reloading);
        }
        public void SessionId_Test()
        {
            var server = EnvironmentGlobal.CreateGameServer("General");

            server.TurnCalculation(1);

            var gameSession = EnvironmentGlobal.GetSessionServerSide(server);

            Assert.AreEqual(1005302115, gameSession.Id);

            server.TurnCalculation(5);

            gameSession = EnvironmentGlobal.GetSessionServerSide(server);

            Assert.AreEqual(1005302115, gameSession.Id);

            server = EnvironmentGlobal.CreateGameServer("Reloading");

            server.TurnCalculation(1);

            gameSession = EnvironmentGlobal.GetSessionServerSide(server);

            Assert.AreEqual(1005302116, gameSession.Id);

            server.TurnCalculation(5);

            gameSession = EnvironmentGlobal.GetSessionServerSide(server);

            Assert.AreEqual(1005302116, gameSession.Id);
        }
        public void SessionName_Test()
        {
            var server = EnvironmentGlobal.CreateGameServer("General");

            var gameSession = EnvironmentGlobal.GetSessionServerSide(server);

            Assert.AreEqual("General", gameSession.ScenarioName);
        }
        public void GameSessionToSessionTransfer_Test()
        {
            var server = EnvironmentGlobal.CreateGameServer("General");

            var gameSession = EnvironmentGlobal.GetSessionServerSide(server);

            var sessionDto = gameSession.ToSessionTransfer();

            Assert.AreEqual(gameSession.IsPause, sessionDto.IsPause);
            Assert.AreEqual(gameSession.ScenarioName, sessionDto.ScenarioName);
            Assert.AreEqual(gameSession.Turn, sessionDto.Turn);
            Assert.AreEqual(gameSession.Rules.IsEventsEnabled, sessionDto.Rules.IsEventsEnabled);
            Assert.AreEqual(gameSession.Rules.Spawn.AsteroidSmallSize, sessionDto.Rules.Spawn.AsteroidSmallSize);
            Assert.AreEqual(gameSession.GetCelestialObjects().Count, sessionDto.CelestialObjects.Count);
            Assert.AreEqual(gameSession.GetCelestialObjects()[0].Id, sessionDto.CelestialObjects[0].Id);
            Assert.AreEqual(gameSession.GameEvents.Count, sessionDto.GameEvents.Count);
            Assert.AreEqual(gameSession.TurnHistory.Count, sessionDto.TurnHistory.Count);
        }
Esempio n. 5
0
        public void ToClientTest()
        {
            var server = EnvironmentGlobal.CreateGameServer("ConvertTests");

            Assert.AreEqual(2, EnvironmentGlobal.GetSession(server).GetCelestialObjects().Count);

            var gameSession = EnvironmentGlobal.GetSession(server);

            Assert.AreEqual(2, gameSession.GetCelestialObjects().Count);

            server.TurnCalculation(2);

            Assert.AreEqual(1, EnvironmentGlobal.GetSessionServerSide(server).ScenarioEvents.Count);

            server.TurnCalculation(10);

            Assert.AreEqual(0, EnvironmentGlobal.GetSession(server).ScenarioEvents.Count);
        }