public ResearchTests()
        {
            ConfigurationManager.SetJson(/*Utility.RESOURCE_JSON,*/ Utility.CONFIGFILE_JSON);
            ConfigurationManager.GetInstance();
            UnitFactory.CleanFactories();
            GathererUnitRegister gathererVisitor = new GathererUnitRegister();

            UnitFactory.AddFactory(gathererVisitor);
            BuilderUnitRegister builderVisitor = new BuilderUnitRegister();

            UnitFactory.AddFactory(builderVisitor);
            FarmerUnitRegister farmerVisitor = new FarmerUnitRegister();

            UnitFactory.AddFactory(farmerVisitor);
            ResearcherUnitRegister researcherVisitor = new ResearcherUnitRegister();

            UnitFactory.AddFactory(researcherVisitor);
        }
Exemple #2
0
        public void CreateResearcherTest()
        {
            Assert.Throws <Exception>(() => UnitFactory.CreateUnit(typeof(Researcher)));
            ResearcherUnitRegister visitor = new ResearcherUnitRegister();

            UnitFactory.AddFactory(visitor);
            var unit = UnitFactory.CreateUnit(typeof(Researcher));

            Assert.IsType <Researcher>(unit);
            var researcher = unit as Researcher;

            Assert.Equal(1, researcher.FoodNeeded);
            Assert.Equal(Satisfaction.Ok, researcher.Satisfaction);
            Assert.Equal(int.MaxValue, researcher.MaxInput);
            Assert.Empty(researcher.InputOutputMapping);
            Assert.Single(researcher.Products);
            Assert.Single(researcher.Products.Where(r => r.Type == "researchpoint" && r.Amount == 1));
        }
Exemple #3
0
        public PlayerTests()
        {
            ConfigurationManager.SetJson(Utility.CONFIGFILE_JSON);

            AlgoFactory.CleanFactories();
            AlgoFactory.AddFactory(AlgoType.Constant);
            AlgoFactory.AddFactory(AlgoType.Exp);
            AlgoFactory.AddFactory(AlgoType.Fibonacci);
            AlgoFactory.AddFactory(AlgoType.Increment);
            AlgoFactory.AddFactory(AlgoType.Multiple);

            UnitFactory.CleanFactories();
            GathererUnitRegister gathererVisitor = new GathererUnitRegister();

            UnitFactory.AddFactory(gathererVisitor);
            BuilderUnitRegister builderVisitor = new BuilderUnitRegister();

            UnitFactory.AddFactory(builderVisitor);
            FarmerUnitRegister farmerVisitor = new FarmerUnitRegister();

            UnitFactory.AddFactory(farmerVisitor);
            ResearcherUnitRegister researcherVisitor = new ResearcherUnitRegister();

            UnitFactory.AddFactory(researcherVisitor);

            BuildingFactory.CleanFactories();

            ForestCampBuildingRegister forestCampVisitor = new ForestCampBuildingRegister();

            BuildingFactory.AddFactory(forestCampVisitor);
            MiningVillageBuildingRegister miningVillageVisitor = new MiningVillageBuildingRegister();

            BuildingFactory.AddFactory(miningVillageVisitor);
            FarmBuildingRegister farmVisitor = new FarmBuildingRegister();

            BuildingFactory.AddFactory(farmVisitor);
            LabBuildingRegister labVisitor = new LabBuildingRegister();

            BuildingFactory.AddFactory(labVisitor);

            Market.ResetMarket();
            Player.GetInstance().ResetPlayer();
        }