예제 #1
0
        public TestGame()
        {
            LoggerFactory           = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
            WorldStateFactory       = new TestWorldStateFactory();
            World                   = WorldStateFactory.CreateDevWorldState().ToMutable();
            GameDef                 = new TestGameDefFactory().CreateGameDef();
            ScoreRepository         = new ScoreRepository(GameDef, World);
            PlayerRepository        = new PlayerRepository(World, ScoreRepository);
            PlayerRepositoryWrite   = new PlayerRepositoryWrite(World);
            ResourceRepository      = new ResourceRepository(World, GameDef);
            ResourceRepositoryWrite = new ResourceRepositoryWrite(World, ResourceRepository);
            ActionQueueRepository   = new ActionQueueRepository(World);
            AssetRepository         = new AssetRepository(World, PlayerRepository, ActionQueueRepository);
            AssetRepositoryWrite    = new AssetRepositoryWrite(LoggerFactory.CreateLogger <AssetRepositoryWrite>(), World, AssetRepository, ResourceRepository, ResourceRepositoryWrite, ActionQueueRepository, GameDef);
            UnitRepository          = new UnitRepository(World, GameDef, PlayerRepository, AssetRepository);
            BattleBehavior          = new BattleBehaviorScoOriginal(LoggerFactory.CreateLogger <IBattleBehavior>());
            UnitRepositoryWrite     = new UnitRepositoryWrite(LoggerFactory.CreateLogger <UnitRepositoryWrite>(), World, GameDef, UnitRepository, ResourceRepositoryWrite, PlayerRepository, BattleBehavior);

            var services = new ServiceCollection();

            services.AddSingleton <IGameTickModule>(new ActionQueueExecutor(AssetRepositoryWrite));
            services.AddSingleton <IGameTickModule>(new ResourceGrowthSco(LoggerFactory.CreateLogger <ResourceGrowthSco>(), GameDef, ResourceRepository, ResourceRepositoryWrite, AssetRepository, UnitRepository));
            GameTickModuleRegistry = new GameTickModuleRegistry(LoggerFactory.CreateLogger <GameTickModuleRegistry>(), services.BuildServiceProvider(), GameDef);
            TickEngine             = new GameTickEngine(LoggerFactory.CreateLogger <GameTickEngine>(), World, GameDef, GameTickModuleRegistry, PlayerRepositoryWrite);
        }
예제 #2
0
        public UserInfoControllerTest()
        {
            ILoggerFactory    doesntDoMuch = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
            Logger <UserInfo> _logger      = new Logger <UserInfo>(doesntDoMuch);

            _service    = new UserInfoServiceMock();
            _controller = new UserInfoController(_service, _logger);
        }