public void TestUnitEmptyLoadout(UnitType type, int infuse, double expectedMinerals, double expectedKills)
        {
            var loadout = TestHelper.GetTestLoadout();
            var cost    = new UnitCostHelper(loadout).GetUnitCost(type, infuse, UnitRankType.None);

            Assert.That(cost.Minerals, Is.EqualTo(expectedMinerals));
            Assert.That(cost.Kills, Is.EqualTo(expectedKills).Within(0.01));
        }
        public void TestUnitCostWithTWLoadout(UnitType type, int dw, int tw, double expected)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .AddDoubleWarp(dw)
                          .AddTripleWarp(tw);
            var cost = new UnitCostHelper(loadout).GetUnitCost(type, 0, UnitRankType.None);

            Assert.That(cost.Minerals, Is.EqualTo(expected).Within(0.01));
        }
        public void TestVeterancy(UnitType unit, int infuse, int vet, double expectedCost)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .AddVeterancy(vet);
            var helper = new UnitCostHelper(loadout);
            var cost   = helper.GetUnitCost(unit, infuse, UnitRankType.None).Kills;

            Assert.That(cost, Is.EqualTo(expectedCost).Within(1));
        }
        public void TestSpecUnitCost(UnitType unit, int specLevel, UnitType spec, bool hasAllSpec, double expectedCost)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .SetSpec(spec, specLevel, hasAllSpec);

            var helper = new UnitCostHelper(loadout);
            var cost   = helper.GetUnitCost(unit, 0, UnitRankType.None);

            Assert.That(cost.Minerals, Is.EqualTo(expectedCost).Within(1));
        }
        [TestCase(UnitType.Dragoon, 0, 600, 250, -700 + 299)]         //299 from rank C
        public void TestKillRecycleCacheUpgrade(UnitType unit, int infuse, int vet, int killRec, double expected)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .AddVeterancy(vet)
                          .AddKillRecycle(killRec)
                          .AddUpgradeCache();
            var helper = new UnitCostHelper(loadout);
            var cost   = helper.GetUnitCost(unit, infuse, UnitRankType.None).Kills;

            Assert.That(cost, Is.EqualTo(expected).Within(1));
        }
        public void TestDNAStart(UnitType unit, int infuse, int dnaStart, double expectedMins, double expectedKills)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .AddVeterancy(200)
                          .AddDNAStartLevel(dnaStart);
            var helper = new UnitCostHelper(loadout);
            var cost   = helper.GetUnitCost(unit, infuse, UnitRankType.None);

            Assert.That(cost.Minerals, Is.EqualTo(expectedMins).Within(1));
            Assert.That(cost.Kills, Is.EqualTo(expectedKills).Within(1));
        }
        public void TestQuickStart(UnitType unit, int infuse, int qsCharges, int vet, double expectedMins, double expectedKills)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .AddVeterancy(vet)
                          .AddQuickStartCharges(qsCharges);
            var helper = new UnitCostHelper(loadout);
            var cost   = helper.GetUnitCost(unit, infuse, UnitRankType.None);

            Assert.That(cost.Minerals, Is.EqualTo(expectedMins).Within(1));
            Assert.That(cost.Kills, Is.EqualTo(expectedKills).Within(1));
        }
        public void TestDNAStartCacheUpgrade(UnitType unit, int inf, double expectedMinerals, double expectedKills)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .AddBlackMarket()
                          .AddDNAStartLevel(5)
                          .AddUpgradeCache();

            var helper = new UnitCostHelper(loadout);
            var cost   = helper.GetUnitCost(unit, inf, UnitRankType.None);

            Assert.That(cost.Kills, Is.EqualTo(expectedKills).Within(1));
            Assert.That(cost.Minerals, Is.EqualTo(expectedMinerals));
        }
        public void TestBlackMarket(UnitType unit, int infuse, int vet, int infRec, int killRec, int dnaStart, double expectedMins, double expectedKills)
        {
            var loadout = TestHelper.GetTestLoadout()
                          .AddVeterancy(vet)
                          .AddBlackMarket()
                          .AddKillRecycle(killRec)
                          .AddInfuseRecycle(infRec)
                          .AddDNAStartLevel(dnaStart);
            var helper = new UnitCostHelper(loadout);
            var cost   = helper.GetUnitCost(unit, infuse, UnitRankType.None);

            Assert.That(cost.Minerals, Is.EqualTo(expectedMins).Within(1));
            Assert.That(cost.Kills, Is.EqualTo(expectedKills).Within(1));
        }
        public void TestAllUnitsHaveCost()
        {
            var loadout = TestHelper.GetTestLoadout();
            var helper  = new UnitCostHelper(loadout);
            var units   = Enums.GetValues <UnitType>();

            foreach (var unit in units)
            {
                helper.ResetCalculationVariables();
                if (unit == UnitType.None)
                {
                    continue;
                }

                var infuse = UnitType.Artifact == unit
                                        ? 0
                                        : 5;
                var cost = helper.GetUnitCost(unit, infuse, UnitRankType.None);

                Assert.That(cost.Minerals, Is.GreaterThan(0));
                Assert.That(cost.Kills, Is.GreaterThan(0));
            }
        }