public void NoFormula() { var data = "Name := Capital Ship Missile I"; var metarec = new MetaRecord(data.Split('\n')); Assert.AreEqual(0, metarec.Parameters.Count()); var recs = metarec.Instantiate(); Assert.AreEqual(1, recs.Count()); Assert.AreEqual("Capital Ship Missile I", recs.First().Get <string>("Name", null).Value); }
public void StaticFormula() { var data = @"Parameter Name := speed Parameter Minimum := 3 Parameter Maximum := 5 Parameter Name := warhead Parameter Maximum := 5 Name := ='Nuclear Missile ' + warhead.ToRomanNumeral() + ' S' + speed.ToString()"; var metarec = new MetaRecord(data.Split('\n')); Assert.AreEqual(2, metarec.Parameters.Count()); Assert.AreEqual(3, metarec.Parameters.First().Minimum); Assert.AreEqual(5, metarec.Parameters.First().Maximum); Assert.AreEqual(1, metarec.Parameters.Last().Minimum); Assert.AreEqual(5, metarec.Parameters.Last().Maximum); var recs = metarec.Instantiate(); Assert.AreEqual(15, recs.Count()); Assert.AreEqual(1, recs.Where(r => r.Get <string>("Name", null) == "Nuclear Missile III S4").Count()); }