public void ItShouldKeepOutputName() { var concept = new Concept <int>("({0} * {1}) + ({2} * {3})") { Title = "Concept" }; var filter = new Filter <int, bool>("{0} > {1}"); filter.SetParameters(new List <IMonthlyParameter <int> > { SetDictionary("0", 10), SetDictionary("1", 1) }); concept.AddFilter(filter); var january = SetDictionary("0", 2); january.Value[Month.January] = 3; concept.SetParameters(new List <IMonthlyParameter <int> > { january, SetDictionary("1", 3), SetDictionary("2", 2), SetDictionary("3", 5) }); var output = SetDictionary("output", 25); concept.AddOutputParameter1(output); concept.Run(); Assert.AreEqual(16, concept.Output1.Value[Month.May]); Assert.AreEqual(16, output.Value[Month.August]); Assert.AreEqual(19, concept.Output1.Value[Month.January]); Assert.AreEqual(19, output.Value[Month.January]); Assert.AreEqual("output", output.Name); }
public void ItShouldReplaceOutputValue() { var filter = new Filter <int, bool>("{0} > {1}"); filter.SetParameters(new List <IMonthlyParameter <int> > { SetDictionary("0", 10), SetDictionary("1", 1) }); var concept = new Concept <int>(); concept.AddFilter(filter); const string text = "({0} * {1}) + ({2} * {3})"; var operation = new RuleTree <int, int>(text); operation.SetParameters( new List <IMonthlyParameter <int> > { SetDictionary("0", 2), SetDictionary("1", 3), SetDictionary("2", 2), SetDictionary("3", 5) }); concept.AddOperation(operation); var output = SetDictionary("output", 25); concept.AddOutputParameter1(output); concept.Run(); Assert.AreEqual(16, concept.Output1.Value[Month.May]); Assert.AreEqual(16, output.Value[Month.August]); }
public void ItShouldAddValueToOutputParameter() { var filter = new Filter <int, bool>("{0} > {1}"); filter.SetParameters(new List <IMonthlyParameter <int> > { SetDictionary("0", 10), SetDictionary("1", 1) }); var concept = new Concept <int>("({0} * {1}) + ({2} * {3})"); concept.AddFilter(filter); concept.SetParameters( new List <IMonthlyParameter <int> > { SetDictionary("0", 2), SetDictionary("1", 3), SetDictionary("2", 2), SetDictionary("3", 5) }); var output = SetDictionary("output", 10); output.IsAccumulator = true; concept.AddOutputParameter1(output); concept.Run(); Assert.AreEqual(26, concept.Output1.Value[Month.June]); Assert.AreEqual(26, output.Value[Month.February]); }