public void TestSequenceLinkFirstSourceThenTarget() { string result = ""; SimplerModel sourceModel = new SimplerModel {Name = "source"}; sourceModel.Executing += (s, e) => result += ((SimplerModel)s).Name; SimplerModel targetModel = new SimplerModel { Name = "target" }; targetModel.Executing += (s, e) => result += ((SimplerModel)s).Name; IDataItem sourceInput = new DataItem { Name = "SI", Value = new object(), Role = DataItemRole.Input }; IDataItem sourceOutput = new DataItem { Name = "SO", Value = new object(), Role = DataItemRole.Output }; IDataItem targetInput = new DataItem { Name = "TI", Value = new object(), Role = DataItemRole.Input }; IDataItem targetOutput = new DataItem { Name = "TO", Value = new object(), Role = DataItemRole.Output }; sourceModel.DataItems.Add(sourceInput); sourceModel.DataItems.Add(sourceOutput); targetModel.DataItems.Add(targetInput); targetModel.DataItems.Add(targetOutput); var compositeModel = new CompositeModel { Name = "composite model", Models = { sourceModel, targetModel } }; targetInput.LinkTo(sourceOutput); compositeModel.Initialize(); compositeModel.Execute(); Assert.AreEqual("sourcetarget", result); }
public void TestProgressIndication() { string result = ""; var model1 = new SimplerModel { Name = "source" }; model1.Executing += (s, e) => result += ((SimplerModel)s).Name; var model2 = new SimplerModel { Name = "target" }; model2.Executing += (s, e) => result += ((SimplerModel)s).Name; var compositeModel = new CompositeModel { Name = "composite model", Models = { model1, model2 } }; var progressList = new List <string>(); compositeModel.ProgressChanged += delegate { progressList.Add(compositeModel.GetProgressText()); }; compositeModel.Initialize(); compositeModel.Execute(); Assert.AreEqual("50.00 %", progressList[0]); Assert.AreEqual("100.00 %", progressList[1]); }
public void TestSequenceLinkFirstSourceThenTarget() { string result = ""; SimplerModel sourceModel = new SimplerModel { Name = "source" }; sourceModel.Executing += (s, e) => result += ((SimplerModel)s).Name; SimplerModel targetModel = new SimplerModel { Name = "target" }; targetModel.Executing += (s, e) => result += ((SimplerModel)s).Name; IDataItem sourceInput = new DataItem { Name = "SI", Tag = "SI", Value = new object(), Role = DataItemRole.Input }; IDataItem sourceOutput = new DataItem { Name = "SO", Tag = "SO", Value = new object(), Role = DataItemRole.Output }; IDataItem targetInput = new DataItem { Name = "TI", Tag = "TI", Value = new object(), Role = DataItemRole.Input }; IDataItem targetOutput = new DataItem { Name = "TO", Tag = "TO", Value = new object(), Role = DataItemRole.Output }; sourceModel.DataItems.Add(sourceInput); sourceModel.DataItems.Add(sourceOutput); targetModel.DataItems.Add(targetInput); targetModel.DataItems.Add(targetOutput); var compositeModel = new CompositeModel { Name = "composite model", Models = { sourceModel, targetModel } }; targetInput.LinkTo(sourceOutput); compositeModel.Initialize(); compositeModel.Execute(); Assert.AreEqual("sourcetarget", result); }