Ejemplo n.º 1
0
        public void Initialise()
        {
            // Required by any tests which use new BeatArg()
            SetEntryAssembly(Assembly.GetExecutingAssembly());
            // Ensure heartbeat returns valid by default
            _mockHeartbeat.Setup(m => m.Beat(ref It.Ref <BeatArg> .IsAny))
            .Callback(new SendHeartbeat((ref BeatArg arg) => arg.Status = BeatResult.Beat));

            _mockConfig.Setup(m => m.WatchPath).Returns(TestHelper.GetFullPath("Watch"));
            _mockConfig.Setup(m => m.ArchiveWatchPath).Returns(TestHelper.GetFullPath("Watch\\Archive"));
            _mockConfig.Setup(m => m.InternalBufferSize).Returns(8192);
            _mockConfig.Setup(m => m.WaitSeconds).Returns(1);

            _startArg = new StartArg(
                _mockUserService.Object,
                _mockFile.Object,
                _mockConfig.Object,
                _mockLogger.Object,
                _mockHeartbeat.Object);
        }
Ejemplo n.º 2
0
        public Ship[] CreateAttackerShips(int playerId, ApiJoinGameInfo attackerJoinGameInfo, StartArg startArg)
        {
            var constraints = attackerJoinGameInfo.ShipConstraints;

            return(initialAttackerShips.Select(
                       x => new Ship(
                           playerId, (int)x.ShipId,
                           (int)constraints.MaxFuelBurnSpeed,
                           x.Matter.ToShipMatter(),
                           x.Position, x.Velocity,
                           (int)constraints.CriticalTemperature, (int)x.Temperature)
                       ).ToArray());
        }
Ejemplo n.º 3
0
        public Ship[] CreateAttackerShips(int playerId, ApiJoinGameInfo attackerJoinGameInfo, StartArg startArg)
        {
            var constraints = attackerJoinGameInfo.ShipConstraints;

            return(startArg.ShipMatter == null
                       ? new Ship[0]
                       : new[]
            {
                new Ship(ownerPlayerId: playerId,
                         uid: 1,
                         maxFuelBurnSpeed: (int)constraints.MaxFuelBurnSpeed,
                         startArg.ShipMatter.ToShipMatter(),
                         position: -initialDefenderPosition,
                         velocity: new V(0, 0),
                         criticalTemperature: (int)constraints.CriticalTemperature,
                         temperature: 0)
            });
        }
Ejemplo n.º 4
0
 public Ship[] CreateDefenderShips(int playerId, ApiJoinGameInfo defenderJoinGameInfo, StartArg startArg)
 {
     defenderPlayerId = playerId;
     return(startArg.ShipMatter == null
                ? new Ship[0]
                : new[]
     {
         new Ship(ownerPlayerId: playerId,
                  uid: 0,
                  maxFuelBurnSpeed: (int)defenderJoinGameInfo.ShipConstraints.MaxFuelBurnSpeed,
                  startArg.ShipMatter.ToShipMatter(),
                  position: initialDefenderPosition,
                  velocity: new V(0, 0), (int)defenderJoinGameInfo.ShipConstraints.CriticalTemperature, 0)
     });
 }