public void Test_EconomyOutput_ReportChaoting() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); var report = Economy.inst.outputs.Single(x => x.name == "STATIC_REPORT_CHAOTING_TAX"); Assert.AreEqual(Root.def.economy.report_chaoting_percent, report.percent.Value); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value, report.maxValue.Value); Assert.AreEqual(report.maxValue.Value * report.percent.Value / 100, report.currValue.Value); report.percent.Value = 12.3; var json = JsonConvert.SerializeObject(Economy.inst, Formatting.Indented); Root.inst.economy = JsonConvert.DeserializeObject <Economy>(json); Assert.AreEqual(12.3, report.percent.Value); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value, report.maxValue.Value); Assert.AreEqual(report.maxValue.Value * report.percent.Value / 100, report.currValue.Value); Date.inst.day.Value = 30; Economy.DaysInc(); Assert.AreEqual(Chaoting.inst.expectMonthTaxValue.Value - report.currValue.Value, Chaoting.inst.oweTax); }
public void Test_EconomyDayInc() { ModDataVisit.InitVisitMap(typeof(Root)); Root.Init(init); ModDataVisit.InitVisitData(Root.inst); Date.inst.day.Value = 29; Economy.DaysInc(); Assert.AreEqual(Root.def.economy.curr, Visitor.Get("economy.value")); Date.inst.day.Value = 30; Economy.DaysInc(); Assert.AreEqual(Root.def.economy.curr + Economy.inst.monthSurplus.Value, Visitor.Get("economy.value")); }