public QsFlowingTuple(params QsTupleValue[] values) { // get the maximum id defined in the array // [to be the ground that will be increased whenever we find element without id] int sid = values.Max(s => s.Id); foreach (var v in values) { if (v.Id == 0) { sid += 10; } var st = ThisFlow.Add(v.Name, v.Id == 0 ? sid : v.Id); if (v.IsLazyValue) { st.Value = v.LazyValue; } else { st.Value = v.Value; } } InitialValues = values; }
public Tensor StepTopK(Flow f, Tensor x, int k) { if (k <= 0 || k >= _bh.Capacity) { return(f.Add(f.MvMultiplyTimed(_wxh, x), _bh)); } return(f.Add(f.MvMultiplyTop(_wxh, x, k), _bh)); }
public void AddThrowsOnDuplicateStepId() { // Arrange var x = new Flow(); const string sameId = "1111"; var step1 = new Step(sameId, "name1", "action1"); var step2 = new Step(sameId, "name2", "action2"); // Act x.Add(step1); x.Add(step2); }
private static Flow DefineDemoQuerySteps() { var retVal = new Flow(); retVal.Add(new Step("10", "Enter the name of the connection string", "Plugin.ConsoleUI.PublishStringFromUI")); retVal.Add(new Step("20", "Get the connection string", "Plugin.DataHelper.PublishConnectionString", new[] { new Parameter("String", "10", 0) })); retVal.Add(new Step("30", "Parse the connection string", "Plugin.DataHelper.ParseConnectionString", new[] { new Parameter("Connection String", "20", 0), })); retVal.Add(new Step("40", "Build DB verification string", "Plugin.DataHelper.PublishSanitisedConnectionStringForVerification", new[] { new Parameter("Connection String Parts", "30", 0), })); retVal.Add(new Step("50", "Confirm DB", "Plugin.ConsoleUI.Confirm", new[] { new Parameter("String", "40", 0), })); retVal.Add(new Step("60", "Publish demo row action", "Plugin.Demo.Query.PublishRowActionForQuery1")); retVal.Add(new Step("80", "Get the query", "Plugin.DataHelper.PublishQuery", new[] { new Parameter("String", "60", 0), new Parameter("Configuration Info", "60", 0), })); retVal.Add(new Step("90", "Run the query", "Plugin.DataHelper.PerformActionOnEveryRow", new[] { new Parameter("Row Action", "60", 0), new Parameter("Connection String", "20", 0), new Parameter("Query Definition", "80", 0), })); return retVal; }
private static Flow DefineDemoCalculatorSteps() { var retVal = new Flow(); retVal.Add(new Step("10", "Enter 1st integer", "Plugin.ConsoleUI.PublishIntegerFromUI")); retVal.Add(new Step("20", "Enter 2nd integer", "Plugin.ConsoleUI.PublishIntegerFromUI")); var trickyStep = new Step("30", "Compute stuff", "Plugin.Demo.Calculator.DoArithmetic"); trickyStep.AddParameter("Integer", 100, new Parameter("Integer", "10", 0)); trickyStep.AddParameter("Integer", 200, new Parameter("Integer", "20", 0)); retVal.Add(trickyStep); retVal.Add(new Step("40", "Format result", "Plugin.Demo.Calculator.FormatNumber", new[] { new Parameter("Number", "30", 3), })); retVal.Add(new Step("50", "Display result", "Plugin.ConsoleUI.DisplayString", new[] { new Parameter("String", "40", 0), })); return retVal; }
private static Flow DefineDemoCurrencyConverterSteps() { var retVal = new Flow(); retVal.Add(new Step("10", "Enter 1st currency", "Plugin.ConsoleUI.PublishStringFromUI")); retVal.Add(new Step("20", "Enter 2nd currency", "Plugin.ConsoleUI.PublishStringFromUI")); var trickyStep = new Step("30", "Get exchange rate", "Plugin.Demo.CurrencyConverter.GetExchangeRate"); trickyStep.AddParameter("String", 1, new Parameter("String", "10", 0)); trickyStep.AddParameter("String", 2, new Parameter("String", "20", 0)); retVal.Add(trickyStep); retVal.Add(new Step("40", "Format result", "Plugin.Demo.Calculator.FormatNumber", new[] { new Parameter("Number", "30", 0), })); retVal.Add(new Step("50", "Display result", "Plugin.ConsoleUI.DisplayString", new[] { new Parameter("String", "40", 0), })); return retVal; }
public void AddIncrementsOrderOfSubsequentSteps() { // Arrange var x = new Flow(); var step1 = new Step("name1", "action"); var step2 = new Step("name2", "action"); // Act x.Add(step1); x.Add(step2); // Assert Assert.AreEqual(1, step1.Order); Assert.AreEqual(2, step2.Order); }
private void load(NowPlayingOverlay music) { StateContainer = music; Flow.Padding = new MarginPadding { Horizontal = Toolbar.HEIGHT / 4 }; Flow.Add(volumeDisplay = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Width = 3f, Height = IconContainer.Height, Margin = new MarginPadding { Horizontal = 2.5f }, Masking = true, Children = new[] { new Circle { RelativeSizeAxes = Axes.Both, Colour = Color4.White.Opacity(0.25f), }, volumeBar = new Circle { RelativeSizeAxes = Axes.Both, Height = 0f, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Colour = Color4.White, } } }); }
public ToolbarUserButton() { AutoSizeAxes = Axes.X; DrawableText.Font = @"Exo2.0-MediumItalic"; Add(new OpaqueBackground { Depth = 1 }); Flow.Add(avatar = new UpdateableAvatar { Masking = true, Size = new Vector2(32), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, CornerRadius = 4, OpenOnClick = { Value = false }, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Radius = 4, Colour = Color4.Black.Opacity(0.1f), } }); }
private void OnDeserialized(StreamingContext context) { foreach (var token in FlowRaw) { Flow.Add(ParseStepData(token)); } }
/// <summary> /// Adds a <see cref="ScoreInfo"/> to this list. /// </summary> /// <param name="score">The <see cref="ScoreInfo"/> to add.</param> /// <param name="isNewLocalScore">Whether this is a score that has just been achieved locally. Controls whether flair is added to the display or not.</param> public ScorePanel AddScore(ScoreInfo score, bool isNewLocalScore = false) { var panel = new ScorePanel(score, isNewLocalScore) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, PostExpandAction = () => PostExpandAction?.Invoke() }.With(p => { p.StateChanged += s => { if (s == PanelState.Expanded) { SelectedScore.Value = p.Score; } }; }); var trackingContainer = panel.CreateTrackingContainer().With(d => { d.Anchor = Anchor.Centre; d.Origin = Anchor.Centre; d.Hide(); }); flow.Add(trackingContainer); if (IsLoaded) { displayScore(trackingContainer); } return(panel); }
private void load(VerifyScreen verify) { hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy(); foreach (IssueType issueType in configurableIssueTypes) { var checkbox = new SettingsCheckbox { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, LabelText = issueType.ToString(), Current = { Default = !hiddenIssueTypes.Contains(issueType) } }; checkbox.Current.SetDefault(); checkbox.Current.BindValueChanged(state => { if (!state.NewValue) { hiddenIssueTypes.Add(issueType); } else { hiddenIssueTypes.Remove(issueType); } }); Flow.Add(checkbox); } }
public void SessionRunManyTimes() { var constant = Flow.Constant(1); var placeholder = Flow.PlaceHolder <int>("number", new int[0]); var operation = Flow.Add(placeholder, Flow.Constant(1)); Context context = new Context(); context.SetNode("number", constant); Session session = new Session(); var result = session.Run(operation, context); Assert.IsNotNull(result); Assert.AreEqual(2, result.GetValue(0)); context.SetNode("number", result); result = session.Run(operation, context); Assert.IsNotNull(result); Assert.AreEqual(3, result.GetValue(0)); context.SetNode("number", result); result = session.Run(operation, context); Assert.IsNotNull(result); Assert.AreEqual(4, result.GetValue(0)); }
public ToolbarUserButton() { AutoSizeAxes = Axes.X; DrawableText.Font = OsuFont.GetFont(italics: true); Add(new OpaqueBackground { Depth = 1 }); Flow.Add(avatar = new UpdateableAvatar(isInteractive: false) { Masking = true, Size = new Vector2(32), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, CornerRadius = 4, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Radius = 4, Colour = Color4.Black.Opacity(0.1f), } }); }
public ToolbarUserButton() { TooltipMain = "我"; TooltipSub = $"在这里查看个人信息"; AutoSizeAxes = Axes.X; DrawableText.Font = OsuFont.GetFont(italics: true); Add(new OpaqueBackground { Depth = 1 }); Flow.Add(avatar = new UpdateableAvatar { Masking = true, Size = new Vector2(32), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, CornerRadius = 4, OpenOnClick = { Value = false }, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Radius = 4, Colour = Color4.Black.Opacity(0.1f), } }); }
public static Report BiggestCountries() { var dc = new DataContext(); var data = new Dictionary<string, GdpItem>(); var src = Pecunia.Services.GdpDataProvider.GetData(); var lastYear = src.Max(a=>a.Year); foreach (var item in src) { GdpItem i; if (!data.TryGetValue(item.Country, out i)) data.Add(item.Country, i = new GdpItem { Country = item.Country }); i.Process(lastYear, item); } var res = data.Values.ToArray(); dc.AddTable("data", res); var table = TableGenerator.GetTable(typeof(GdpItem), "data"); table.Columns.Last().SortIndex = 0; table.Columns.Last().SortDirection = SortDirection.Descending; for (var i = 0; i < 5; i++) { table.Columns[i + 2].HeaderText = (lastYear - 4 + i).ToString(); } var flow = new Flow { Orientation = FlowOrientation.Vertical }; flow.Add(table); return Report.CreateReport(flow, dc); }
public ToolbarUserButton() { DrawableText.Font = @"Exo2.0-MediumItalic"; Add(new OpaqueBackground { Depth = 1 }); Flow.Add(avatar = new Avatar()); }
private void load(VerifyScreen verify) { Flow.Add(new SettingsEnumDropdown <DifficultyRating> { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, TooltipText = "Affects checks that depend on difficulty level", Current = verify.InterpretedDifficulty.GetBoundCopy() }); }
private void load() { Flow.Add(new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(FONT_SIZE / 2) }); }
public void ValidateAddsErrorIfParameterTypeIsDifferent() { // Arrange var x = new Flow(); var step1 = new Step("1", "GetIntFromUI"); var step2 = new Step("2", "PrintInt", new List<Parameter> { new Parameter("string", step1.Id, 0) }); x.Add(step1); x.Add(step2); var actions = new CalculatorActionDefinitionProvider().Get; // Act var errors = x.Validate(actions); // Assert Assert.IsNotNull(errors); Assert.AreEqual(2, errors.Count); Assert.IsTrue(errors[0].Message.Contains("parameter is of type")); Assert.IsTrue(errors[0].Message.Contains("while action needs")); }
public void AddIntegerSingleValues() { INode <int> left = Flow.Constant(1); INode <int> right = Flow.Constant(41); var add = Flow.Add(left, right); Assert.AreEqual(left.Rank, add.Rank); Assert.IsTrue(left.Shape.SequenceEqual(add.Shape)); Assert.AreEqual(42, add.GetValue()); }
public void AddDoubleSingleValues() { INode <double> left = Flow.Constant(0.5); INode <double> right = Flow.Constant(41.5); var add = Flow.Add(left, right); Assert.AreEqual(left.Rank, add.Rank); Assert.IsTrue(left.Shape.SequenceEqual(add.Shape)); Assert.AreEqual(42, add.GetValue()); }
public void AddVectorsWithDifferentLengths() { INode <int> left = Flow.Constant(new int[] { 1, 2, 3 }); INode <int> right = Flow.Constant(new int[] { 4, 5, 6, 7 }); try { Flow.Add(left, right); Assert.Fail(); } catch (InvalidOperationException) { } }
public void AddIncrementsOrderOfFirstStep() { // Arrange var x = new Flow(); var step = new Step("name", "action"); int previous = step.Order; // Act x.Add(step); // Assert Assert.AreEqual(0, previous); Assert.AreEqual(1, step.Order); }
/// <summary> /// Adds a <see cref="ScoreInfo"/> to this list. /// </summary> /// <param name="score">The <see cref="ScoreInfo"/> to add.</param> /// <param name="isNewLocalScore">Whether this is a score that has just been achieved locally. Controls whether flair is added to the display or not.</param> public ScorePanel AddScore(ScoreInfo score, bool isNewLocalScore = false) { var panel = new ScorePanel(score, isNewLocalScore) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, PostExpandAction = () => PostExpandAction?.Invoke() }.With(p => { p.StateChanged += s => { if (s == PanelState.Expanded) { SelectedScore.Value = p.Score; } }; }); flow.Add(panel.CreateTrackingContainer().With(d => { d.Anchor = Anchor.Centre; d.Origin = Anchor.Centre; })); if (IsLoaded) { if (SelectedScore.Value == score) { SelectedScore.TriggerChange(); } else { // We want the scroll position to remain relative to the expanded panel. When a new panel is added after the expanded panel, nothing needs to be done. // But when a panel is added before the expanded panel, we need to offset the scroll position by the width of the new panel. if (expandedPanel != null && flow.GetPanelIndex(score) < flow.GetPanelIndex(expandedPanel.Score)) { // A somewhat hacky property is used here because we need to: // 1) Scroll after the scroll container's visible range is updated. // 2) Scroll before the scroll container's scroll position is updated. // Without this, we would have a 1-frame positioning error which looks very jarring. scroll.InstantScrollTarget = (scroll.InstantScrollTarget ?? scroll.Target) + ScorePanel.CONTRACTED_WIDTH + panel_spacing; } } } return(panel); }
public void AddSingleValues() { INode <int> left = new SingleValue <int>(1); INode <int> right = new SingleValue <int>(41); var add = Flow.Add(left, right); Assert.AreEqual(left.Rank, add.Rank); Assert.IsTrue(left.Shape.SequenceEqual(right.Shape)); var result = add.Evaluate(); Assert.IsNotNull(result); Assert.AreEqual(left.Rank, result.Rank); Assert.IsTrue(left.Shape.SequenceEqual(result.Shape)); Assert.AreEqual(42, result.GetValue()); }
public void ValidateAddsErrorIfNumberOfInputParametersIsLessThanExpected() { // Arrange var x = new Flow(); var step = new Step(null, "DoArithmetic"); var prm = new Parameter("int", step.Id, 0); step.AddParameter(prm); x.Add(step); var actions = new CalculatorActionDefinitionProvider().Get; // Act var errors = x.Validate(actions); // Assert Assert.IsNotNull(errors); Assert.AreEqual(1, errors.Count); Assert.IsTrue(errors[0].Message.Contains("Number of input parameters")); }
public void AddIntegerVectors() { INode <int> left = Flow.Constant(new int[] { 1, 2, 3 }); INode <int> right = Flow.Constant(new int[] { 4, 5, 6 }); var add = Flow.Add(left, right); Assert.AreEqual(left.Rank, add.Rank); Assert.IsTrue(left.Shape.SequenceEqual(right.Shape)); var result = add.Evaluate(); Assert.IsNotNull(result); Assert.AreEqual(left.Rank, result.Rank); Assert.IsTrue(left.Shape.SequenceEqual(result.Shape)); Assert.AreEqual(5, result.GetValue(0)); Assert.AreEqual(7, result.GetValue(1)); Assert.AreEqual(9, result.GetValue(2)); }
public void AddDoubleVectors() { INode <double> left = Flow.Constant(new double[] { 1.5, 2.5, 3.5 }); INode <double> right = Flow.Constant(new double[] { 4.0, 5.0, 6.0 }); var add = Flow.Add(left, right); Assert.AreEqual(left.Rank, add.Rank); Assert.IsTrue(left.Shape.SequenceEqual(right.Shape)); var result = add.Evaluate(); Assert.IsNotNull(result); Assert.AreEqual(left.Rank, result.Rank); Assert.IsTrue(left.Shape.SequenceEqual(result.Shape)); Assert.AreEqual(5.5, result.GetValue(0)); Assert.AreEqual(7.5, result.GetValue(1)); Assert.AreEqual(9.5, result.GetValue(2)); }
public static Report FastestGrowingCountries() { var dc = new DataContext(); var data = new Dictionary <string, GrowthItem>(); var src = Pecunia.Services.GdpDataProvider.GetData(); var lastYear = src.Max(a => a.Year); foreach (var item in src) { GrowthItem i; if (!data.TryGetValue(item.Country, out i)) { data.Add(item.Country, i = new GrowthItem { Country = item.Country }); } i.Process(lastYear, item); } var res = data.Values.ToArray(); dc.AddTable("data", res); var table = TableGenerator.GetTable(typeof(GrowthItem), "data"); table.Columns.Last().SortIndex = 0; table.Columns.Last().SortDirection = SortDirection.Descending; for (var i = 0; i < 5; i++) { table.Columns[i + 2].HeaderText = (lastYear - 4 + i).ToString(); table.Columns[i + 2].ConditionalFormatting = ConditionalFormatters.PercentChange; } var flow = new Flow { Orientation = FlowOrientation.Vertical }; flow.Add(table); return(Report.CreateReport(flow, dc)); }
public void ApplyContextOnBinaryOperation() { PlaceHolderNode <int> node = new PlaceHolderNode <int>("answer", new int[0]); INode <int> value1 = Flow.Constant(38); INode <int> value2 = Flow.Constant(2); INode <int> value1b = Flow.Constant(40); INode <int> oper = Flow.Add(node, value2); Context context = new Context(); context.SetNode("answer", value1); Assert.IsTrue(oper.ApplyContext(context)); oper.Evaluate(); Assert.AreEqual(40, oper.GetValue(0)); context.SetNode("answer", value1b); Assert.IsTrue(oper.ApplyContext(context)); oper.Evaluate(); Assert.AreEqual(42, oper.GetValue(0)); }
public void AddIntegerMatrices() { INode <int> left = Flow.Constant(new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 } }); INode <int> right = Flow.Constant(new int[][] { new int[] { 10, 20, 30 }, new int[] { 40, 50, 60 } }); var add = Flow.Add(left, right); Assert.AreEqual(left.Rank, add.Rank); Assert.IsTrue(left.Shape.SequenceEqual(right.Shape)); var result = add.Evaluate(); Assert.IsNotNull(result); Assert.AreEqual(left.Rank, result.Rank); Assert.IsTrue(left.Shape.SequenceEqual(result.Shape)); Assert.AreEqual(11, result.GetValue(0, 0)); Assert.AreEqual(22, result.GetValue(0, 1)); Assert.AreEqual(33, result.GetValue(0, 2)); Assert.AreEqual(44, result.GetValue(1, 0)); Assert.AreEqual(55, result.GetValue(1, 1)); Assert.AreEqual(66, result.GetValue(1, 2)); }
public void AddDoubleMatrices() { INode <double> left = Flow.Constant(new double[][] { new double[] { 1.5, 2.5, 3.5 }, new double[] { 4.5, 5.5, 6.5 } }); INode <double> right = Flow.Constant(new double[][] { new double[] { 10.0, 20.0, 30.0 }, new double[] { 40.0, 50.0, 60.0 } }); var add = Flow.Add(left, right); Assert.AreEqual(left.Rank, add.Rank); Assert.IsTrue(left.Shape.SequenceEqual(right.Shape)); var result = add.Evaluate(); Assert.IsNotNull(result); Assert.AreEqual(left.Rank, result.Rank); Assert.IsTrue(left.Shape.SequenceEqual(result.Shape)); Assert.AreEqual(11.5, result.GetValue(0, 0)); Assert.AreEqual(22.5, result.GetValue(0, 1)); Assert.AreEqual(33.5, result.GetValue(0, 2)); Assert.AreEqual(44.5, result.GetValue(1, 0)); Assert.AreEqual(55.5, result.GetValue(1, 1)); Assert.AreEqual(66.5, result.GetValue(1, 2)); }
public void ValidateAddsErrorIfStepActionIsUnknown() { // Arrange var x = new Flow(); var step = new Step(null, "UnknownAction"); x.Add(step); var actions = new CalculatorActionDefinitionProvider().Get; // Act var errors = x.Validate(actions); // Assert Assert.IsNotNull(errors); Assert.AreEqual(1, errors.Count); Assert.IsTrue(errors[0].Message.Contains("Unknown action")); }
public void RemoveDecrementsOrderOfRemainingStepsWhenTheMiddleOneIsRemoved() { // Arrange var x = new Flow(); var step1 = new Step("name1", "action"); var step2 = new Step("name2", "action"); var step3 = new Step("name3", "action"); // Act x.Add(step1); x.Add(step2); x.Add(step3); int before1 = step1.Order; int before2 = step2.Order; int before3 = step3.Order; x.Remove(step2); int after1 = step1.Order; int after3 = step3.Order; // Assert Assert.AreEqual(1, before1); Assert.AreEqual(2, before2); Assert.AreEqual(3, before3); Assert.AreEqual(1, after1); Assert.AreEqual(2, after3); }
public void RemoveDoesNothingToOrderWhenLastStepIsRemoved() { // Arrange var x = new Flow(); var step1 = new Step("name1", "action"); var step2 = new Step("name2", "action"); var step3 = new Step("name3", "action"); // Act x.Add(step1); x.Add(step2); x.Add(step3); int before1 = step1.Order; int before2 = step2.Order; int before3 = step3.Order; x.Remove(step3); int after1 = step1.Order; int after2 = step2.Order; // Assert Assert.AreEqual(1, before1); Assert.AreEqual(2, before2); Assert.AreEqual(3, before3); Assert.AreEqual(1, after1); Assert.AreEqual(2, after2); }
public void StepCreationOrderIsIrrelevantToOrder() { // Arrange var x = new Flow(); var step1 = new Step("name1", "action"); var step2 = new Step("name2", "action"); var step3 = new Step("name3", "action"); // Act x.Add(step3); x.Add(step1); x.Add(step2); // Assert Assert.AreEqual(1, step3.Order); Assert.AreEqual(2, step1.Order); Assert.AreEqual(3, step2.Order); }
public void StepRemovedAndReinsertedHasNewOrder() { // Arrange var x = new Flow(); var step1 = new Step("name1", "action"); var step2 = new Step("name2", "action"); var step3 = new Step("name3", "action"); // Act x.Add(step1); x.Add(step2); x.Add(step3); x.Remove(step1); x.Add(step1); // Assert Assert.AreEqual(3, step1.Order); }
public void OrderedContentsIsSortedByOrder() { // Arrange var x = new Flow(); var step1 = new Step("name1", "action"); var step2 = new Step("name2", "action"); var step3 = new Step("name3", "action"); // Act x.Add(step1); x.Add(step2); x.Add(step3); step2.Order = 1; step1.Order = 3; step3.Order = 2; // Assert int last = -1; foreach (var step in x.OrderedContents) { if (last == -1) last = step.Order; else Assert.IsTrue(last < step.Order); } }
public Tensor StepTime(Flow f, Tensor x) { return(f.Add(f.MvMultiplyTimed(_wxh, x), _bh)); }
public void ValidateAddsErrorIfStepNameIsNull() { // Arrange var x = new Flow(); var step = new Step(null, "GetIntFromUI"); step.Name = null; x.Add(step); var actions = new CalculatorActionDefinitionProvider().Get; // Act var errors = x.Validate(actions); // Assert Assert.IsNotNull(errors); Assert.AreEqual(1, errors.Count); Assert.IsTrue(errors[0].Message.Contains("is not named")); }
public void ValidateAddsErrorIfParameterWasNotPreviouslyPublished() { // Arrange var x = new Flow(); var step = new Step(null, "PrintInt"); var prm = new Parameter("int", step.Id, 0); step.AddParameter(prm); x.Add(step); var actions = new CalculatorActionDefinitionProvider().Get; // Act var errors = x.Validate(actions); // Assert Assert.IsNotNull(errors); Assert.AreEqual(1, errors.Count); Assert.IsTrue(errors[0].Message.Contains("has not been previously published")); }
private static Flow CreateValidFlow() { var x = new Flow(); var step1 = new Step("1", "Get 1st int", "GetIntFromUI"); var step2 = new Step("2", "Get 2nd int", "GetIntFromUI"); var step3 = new Step("3", "Do the math", "DoArithmetic"); step3.AddParameter("int", 111, new Parameter("int", step1.Id, 0)); step3.AddParameter("int", 222, new Parameter("int", step2.Id, 0)); var step4 = new Step("4", "Print product", "PrintInt", new[] { new Parameter("int", step3.Id, 333) }); x.Add(step1); x.Add(step2); x.Add(step3); x.Add(step4); return x; }