public void ConvertGoldMineToDescriptor_Ok() { var goldMine = new GoldMine(); var goldMineDescriptor = goldMine.ToGoldMineDescriptor(); Assert.AreEqual(goldMine.Stock[ResourcesType.Gold], goldMineDescriptor.Stock[ResourcesType.Gold]); }
public static IGameDescriptor GenerateDefaultMap() { TownHall townHall = new TownHall("TownHall", 100, 100, false, null, new Coordinates { x = 13, y = 34 }); Carry carry = new Carry(0, "Carry1", new Coordinates { x = 1220, y = 620 }); //Tree tree = new Tree("Tree1", new Coordinates { x = 30, y = 30 }); GoldMine mine = new GoldMine(0, "Gold mine1", new Coordinates { x = 1301, y = 82 }); Farm farm1 = new Farm(0, "Farm1", new Coordinates { x = 23, y = 557 }); Farm farm2 = new Farm(1, "Farm2", new Coordinates { x = 178, y = 557 }); Worker worker1 = new Worker(100, false, null, new Coordinates { x = 400, y = 400 }); Worker worker2 = new Worker(100, false, null, new Coordinates { x = 450, y = 450 }); var Resources = new SerializableDictionary <ResourcesType, int> { { ResourcesType.Gold, 1000 }, { ResourcesType.Stone, 1000 }, { ResourcesType.Wood, 1000 } }; var game = new GameDescriptor(); game.TownHalls.Add(townHall.ToTownHallDescriptor()); game.Carries.Add(carry.ToCarryDescriptor()); //game.Trees.Add(tree); game.GoldMines.Add(mine.ToGoldMineDescriptor()); game.Farms.Add(farm1.ToFarmDescriptor()); game.Farms.Add(farm2.ToFarmDescriptor()); game.Workers.Add(worker1.ToWorkerDescriptor()); game.Workers.Add(worker2.ToWorkerDescriptor()); game.Resources = Resources; game.MaxPopulation = game.Farms.Count * game.Farms[0].PopulationIncrement; game.ActualPopulation = game.Workers.Count * game.Workers[0].PopulationSlots; return((IGameDescriptor)game); }