public ProductionForEmpire() { _systems = new StarSystem[] { new StarSystem { Development = 300.0 }, new StarSystem { Development = 450.0 }, new StarSystem { Development = 250.0 }, new StarSystem { Development = 800.0 }, new StarSystem { Development = 200.0 } }; _empire = new EmpireSystemsView { Empire = new Empire { Alignment = new Alignment { Power = 1.0 } }, StarSystems = _systems }; _militaryCalculator = new MilitaryCalculator(_configuration.Object, _random.Object); }
public GrowthFromSystem() { _connectedSystems = new StarSystem[] { new StarSystem { Development = 300, Id = ObjectId.GenerateNewId() }, new StarSystem { Development = 200, Id = ObjectId.GenerateNewId() }, new StarSystem { Development = 400, Id = ObjectId.GenerateNewId() } }; _targetSystem = new StarSystem { Development = 100.0, ConnectedSystemIds = new ObjectId[] { _connectedSystems[0].Id, _connectedSystems[1].Id, _connectedSystems[2].Id }, Id = ObjectId.GenerateNewId() }; _systems = new StarSystem[] { _connectedSystems[0], _connectedSystems[1], _connectedSystems[2], new StarSystem { Development = 500.0, Id = ObjectId.GenerateNewId() }, new StarSystem { Development = 250.0, Id = ObjectId.GenerateNewId() } }; _empireView = new EmpireSystemsView { StarSystems = _systems, Empire = new Empire { Alignment = new Alignment { Prosperity = 1.0 } } }; var developmentCalculator = new DevelopmentCalculator(_configuration.Object); developmentCalculator.SetConnectedSystemsOnlyHook(_connectedSystemsOnlyDelegate.Object); _developmentCalculator = developmentCalculator; }
public void ProductionIsZeroWhenNoSystemsPresent() { var empire = new EmpireSystemsView { Empire = new Empire { Alignment = new Alignment { Power = 1.0 } }, StarSystems = new StarSystem[0] }; var result = _militaryCalculator.ProductionForEmpire(empire); Assert.Equal(0, result); }
private EmpireSystemsView SetupGrowthCalculator() { var starSystems = new StarSystem[] { new StarSystem { Id = ObjectId.GenerateNewId(), }, new StarSystem { Id = ObjectId.GenerateNewId(), }, new StarSystem { Id = ObjectId.GenerateNewId(), }, new StarSystem { Id = ObjectId.GenerateNewId(), }, new StarSystem { Id = ObjectId.GenerateNewId(), } }; starSystems[0].ConnectedSystemIds = new ObjectId[] { starSystems[2].Id, starSystems[4].Id }; starSystems[1].ConnectedSystemIds = new ObjectId[] { starSystems[2].Id, starSystems[4].Id }; starSystems[2].ConnectedSystemIds = new ObjectId[] { starSystems[3].Id }; starSystems[3].ConnectedSystemIds = new ObjectId[] { starSystems[2].Id }; starSystems[4].ConnectedSystemIds = new ObjectId[] { starSystems[0].Id, starSystems[1].Id }; _developmentCalculator .Setup(x => x.GrowthFromSystem(starSystems[0], It.IsAny <EmpireSystemsView>())) .Returns(new GrowthFromSystemResult[] { new GrowthFromSystemResult(starSystems[2].Id, 300.0), new GrowthFromSystemResult(starSystems[4].Id, 150.0) }); _developmentCalculator .Setup(x => x.GrowthFromSystem(starSystems[1], It.IsAny <EmpireSystemsView>())) .Returns(new GrowthFromSystemResult[] { new GrowthFromSystemResult(starSystems[2].Id, 20.0), new GrowthFromSystemResult(starSystems[4].Id, 450.0) }); _developmentCalculator .Setup(x => x.GrowthFromSystem(starSystems[2], It.IsAny <EmpireSystemsView>())) .Returns(new GrowthFromSystemResult[] { new GrowthFromSystemResult(starSystems[3].Id, 270.0) }); _developmentCalculator .Setup(x => x.GrowthFromSystem(starSystems[3], It.IsAny <EmpireSystemsView>())) .Returns(new GrowthFromSystemResult[] { new GrowthFromSystemResult(starSystems[2].Id, 80.0) }); _developmentCalculator .Setup(x => x.GrowthFromSystem(starSystems[4], It.IsAny <EmpireSystemsView>())) .Returns(new GrowthFromSystemResult[] { new GrowthFromSystemResult(starSystems[0].Id, 90.0), new GrowthFromSystemResult(starSystems[1].Id, 230.0) }); var view = new EmpireSystemsView { Empire = new Empire() { StarSystemsIds = starSystems.Select(x => x.Id), Alignment = new Alignment() }, StarSystems = starSystems }; _empireRepository.Setup(x => x.GetEmpireSystemsView(It.IsAny <ObjectId>())) .Returns(view); return(view); }