public static Workflow Build(string requiredRole) { var select = new StepBuilder <ISelectQueryExecutionStep>(); var view = new StepBuilder <IViewQueryExecutionStep>(); select .Edge(x => x.Back).MapsTo(EdgeDone) .Edge(x => x.Canceled).MapsTo(EdgeCanceled) .Edge(x => x.Create).MapsTo(EdgeFailed) .Edge(x => x.Delete).MapsTo(EdgeFailed) .Edge(x => x.Edit).MapsTo(view) .Input(x => x.CanGoBack).Constant(false) .SetUniqueWorkflowStepId(WorkflowIds.QueryExecutionWorkflow); view .Edge(x => x.Back).MapsTo(select) .Edge(x => x.Canceled).MapsTo(EdgeCanceled) .Edge(x => x.Saved).MapsTo(EdgeFailed) .Input(x => x.Id).From(select).Output(x => x.SingleSelectId); return(WorkflowBuilder.Create() .WithId(WorkflowIds.QueryExecutionWorkflow) .WithDefinition(nameof(WorkflowIds.QueryExecutionWorkflow)) .WithEdges(EdgeDone, EdgeCanceled, EdgeFailed) .WithRequiredRole(requiredRole) .StartWith(select)); }
public void StepBuilderShouldContainEmptyDeefaultHandler() { var builder = new StepBuilder(new ProcessBuilder(id: "p_1"), id: "123", name: "Start", description: "Start Step"); Assert.IsNotNull(builder.StepHandler); Assert.AreEqual(StepHandlerTypeEnum.None, builder.StepHandler.StepHandlerType); }
public void TestExceptionThrownIfNoSteps() { var stepbuilder = new StepBuilder(new MockEntitySupplier()); var s = TestHelpers.GetSampleGPL(2, 0); stepbuilder.GetStepsFromInput(s); }
public void Should_add_table_steps_to_scenario() { var gherkinEvents = MockRepository.GenerateStub <IGherkinParserEvents>(); var stepBuilder = new StepBuilder(gherkinEvents); var feature = new Feature("title"); var scenario = new Scenario("title", "source", feature); gherkinEvents.Raise(_ => _.FeatureEvent += null, this, new EventArgs <Feature>(feature)); gherkinEvents.Raise(_ => _.ScenarioEvent += null, this, new EventArgs <Scenario>(scenario)); gherkinEvents.Raise(_ => _.StepEvent += null, this, new EventArgs <StringStep>(new StringStep("step 1", "source"))); gherkinEvents.Raise(_ => _.StepEvent += null, this, new EventArgs <StringStep>(new StringStep("step 2", "source"))); gherkinEvents.Raise(_ => _.TableEvent += null, this, new EventArgs <IList <IList <Token> > >(new List <IList <Token> > { new List <Token> { new Token("A", new LineInFile(1)), new Token("B", new LineInFile(1)) }, new List <Token> { new Token("1", new LineInFile(2)), new Token("2", new LineInFile(2)) }, })); gherkinEvents.Raise(_ => _.EofEvent += null, this, new EventArgs()); Assert.That(scenario.Steps.Count(), Is.EqualTo(2)); Assert.That(scenario.Steps.ToList()[0], Is.TypeOf <StringStep>()); Assert.That(scenario.Steps.ToList()[1], Is.TypeOf <StringTableStep>()); }
public MonthSummaryBuilder(int targetYear, int targetMonth, DateTimeZone zone, StepBuilder stepBuilder, GeneralRecordsBuilder generalRecordsBuilder, HealthMarkersBuilder healthMarkersBuilder, NutritionBuilder nutritionBuilder, WorkoutBuilderFactory workoutBuilderFactory, DistanceCyclingBuilder distanceCyclingBuilder, MassBuilder massBuilder, BodyFatPercentageBuilder bodyFatBuilder) { _monthDays = Enumerable.Range(1, DateTime.DaysInMonth(targetYear, targetMonth)) .Select(d => new LocalDate(targetYear, targetMonth, d)) .ToList(); var range = new DateRange(_monthDays.First().AtStartOfDayInZone(zone), _monthDays.Last().AtStartOfDayInZone(zone)); _columns = Enumerable.Empty <Column <LocalDate> >() .Concat(stepBuilder.BuildSummaryForDateRange(range)) .Concat(bodyFatBuilder.BuildSummaryForDateRange(range)) .Concat(generalRecordsBuilder.BuildSummaryForDateRange(range)) .Concat(healthMarkersBuilder.BuildSummaryForDateRange(range)) .Concat(nutritionBuilder.BuildSummaryForDateRange(range)) .Concat(massBuilder.BuildSummaryForDateRange(range)) .Concat(distanceCyclingBuilder.BuildSummaryForDateRange(range)) .Concat(workoutBuilderFactory.GetWorkoutBuilders().SelectMany(b => b.BuildSummaryForDateRange(range))) ; }
public static IStep1 Initialize() { var builder = new StepBuilder(); //do initialisation stuff return(builder); }
public void CallToDoneShouldReturnParentBuilder() { var builder = new StepBuilder(parent: new ProcessBuilder(id: "p_1"), id: "123", name: "Start", description: "Start Step"); SecurityBuilder <StepBuilder> sb = new SecurityBuilder <StepBuilder>(builder); Assert.AreEqual(builder, sb.Done()); }
public IUserTaskBuilder <TData> WithEscalation(Expression <Func <TData, TimeSpan> > after, Expression <Func <TData, string> > newUser, Action <IWorkflowBuilder <TData> > action = null) { var newStep = new EscalateStep(); WorkflowBuilder.AddStep(newStep); var stepBuilder = new StepBuilder <TData, Escalate>(WorkflowBuilder, newStep); stepBuilder.Input(step => step.TimeOut, after); stepBuilder.Input(step => step.NewUser, newUser); _wrapper.Escalations.Add(newStep); if (action != null) { var lastStep = WorkflowBuilder.LastStep; action.Invoke(WorkflowBuilder); if (WorkflowBuilder.LastStep > lastStep) { newStep.Outcomes.Add(new StepOutcome() { NextStep = lastStep + 1 }); } } return(this); }
public void TestMoveToPositionStepCreated() { var builder = new StepBuilder(new MockEntitySupplier()); BaseStep step = builder.BuildStep("Joey => Lucy"); Assert.AreEqual(typeof(MoveToPositionStep), step.GetType()); }
public void TestGetSecurityBuilder() { var builder = new StepBuilder(new ProcessBuilder(id: "p_1"), id: "123", name: "Start", description: "Start Step"); var sb = builder.Security(); Assert.IsNotNull(sb); }
public void FinalizeActionWithoutNameSouldThrowException() { Assert.Throws <ArgumentNullException>(() => { var builder = new StepBuilder(new ProcessBuilder(id: "p_1"), id: "123", name: "Start", description: "Start Step"); builder.Action().Description("Provide Documentation").Skippable(false).Done(); }); }
public void TestWaypointMoveBack() { var builder = new StepBuilder(new MockEntitySupplier()); var step = builder.BuildStep("Joey <=") as WaypointMove; Assert.AreEqual(step.Increment, -1); }
public void TestActivateStep() { var builder = new StepBuilder(new MockEntitySupplier()); var step = builder.BuildStep("activate Door"); Assert.AreEqual(typeof(ActivateStep), step.GetType()); }
public void TestStepRef() { var builder = new StepBuilder(new MockEntitySupplier()); var step = builder.BuildStep("Joey say \"Hello\" --ref=banana"); Assert.AreEqual("banana", step.RefID); }
public void TestWaypointMove() { var builder = new StepBuilder(new MockEntitySupplier()); var step = builder.BuildStep("Joey =>"); Assert.AreEqual(typeof(WaypointMove), step.GetType()); }
public void TestCamPose() { var builder = new StepBuilder(new MockEntitySupplier()); var c = builder.BuildStep("cam --low"); Assert.AreEqual("low", ((CameraTarget)c).Pose); }
public void TestCamSpeed() { var builder = new StepBuilder(new MockEntitySupplier()); var c = builder.BuildStep("cam --speed=180") as CameraTarget; Assert.AreEqual(180f, (c.Speed)); }
public void TestPosemasterStepCreated() { var builder = new StepBuilder(new MockEntitySupplier()); BaseStep step = builder.BuildStep("Joey celebrate"); Assert.AreEqual(typeof(PoseMasterStep), step.GetType()); }
public void TestParsingAction() { var builder = new StepBuilder(new MockEntitySupplier()); string input = "Magus say \"Citan told me all about your story. Do you want to talk about it?#>Why didn't you tell me? It sounds pretty rough.\""; builder.GetActionFromInput(input); }
public void TestTurnVectorStepCreated() { var builder = new StepBuilder(new MockEntitySupplier()); BaseStep step = builder.BuildStep("Joey turn south"); Assert.AreEqual(typeof(TurnVectorStep), step.GetType()); }
public void TestIfWaitCanBeSkipped() { var builder = new StepBuilder(new MockEntitySupplier()); WaitStep step = builder.BuildStep("wait 1000 !!") as WaitStep; Assert.IsFalse(step.Wait); }
public void TestCamTargetStepCreated() { var builder = new StepBuilder(new MockEntitySupplier()); BaseStep step = builder.BuildStep("cam => Joey"); Assert.AreEqual(typeof(CameraTarget), step.GetType()); }
public void TestSpeechBubbleCreated() { var builder = new StepBuilder(new MockEntitySupplier()); BaseStep step = builder.BuildStep("Joey say \"Citan told me all about your story. Do you want to talk about it? Why didn't you tell me? It sounds pretty rough.\""); Assert.AreEqual(typeof(SpeechBubble), step.GetType()); }
public void TestWaitStepCreated() { var builder = new StepBuilder(new MockEntitySupplier()); BaseStep step = builder.BuildStep("wait 1000"); Assert.AreEqual(typeof(WaitStep), step.GetType()); }
public void TestParameterIsParsedFromString() { var builder = new StepBuilder(new MockEntitySupplier()); var value = builder.GetParameterFromInput("Joey say \"Hello! Good to meet you sir!\""); Assert.AreEqual("Hello! Good to meet you sir!", value); }
public static Workflow Build(string requiredRole) { var selectCategory = new StepBuilder <ISelectCategoryWithQueryCountStep>(); var invokeWorkflow = new StepBuilder <IInvokeSearchQueryByCategoryIdWorkflowStep>(); selectCategory .Edge(x => x.Back).MapsTo(EdgeDone) .Edge(x => x.Canceled).MapsTo(EdgeCanceled) .Edge(x => x.Create).MapsTo(selectCategory) .Edge(x => x.Edit).MapsTo(invokeWorkflow) .Edge(x => x.Delete).MapsTo(selectCategory) .Input(x => x.CanGoBack).Constant(false) .SetUniqueWorkflowStepId(WorkflowIds.SearchQueryByCategoryWorkflow); invokeWorkflow .Edge(x => x.Done).MapsTo(selectCategory) .Edge(x => x.Canceled).MapsTo(EdgeCanceled) .Edge(x => x.Failed).MapsTo(EdgeFailed) .Input(x => x.CategoryId).From(selectCategory).Output(x => x.SingleSelectId); return(WorkflowBuilder.Create() .WithId(WorkflowIds.SearchQueryByCategoryWorkflow) .WithDefinition(nameof(WorkflowIds.SearchQueryByCategoryWorkflow)) .WithEdges(EdgeDone, EdgeCanceled, EdgeFailed) .WithRequiredRole(requiredRole) .StartWith(selectCategory)); }
public void TestEntityIsParsedFromString() { var builder = new StepBuilder(new MockEntitySupplier()); var capitalJoey = builder.GetEntityFromInput("Joey say \"Hello! Good to meet you sir!\""); Assert.AreEqual(typeof(CutsceneEntity), capitalJoey.GetType()); }
public void TestLoadSceneStep() { var builder = new StepBuilder(new MockEntitySupplier()); BaseStep step = builder.BuildStep("load_scene test_scene"); Assert.AreEqual(typeof(LoadSceneStep), step.GetType()); Assert.IsTrue((step as LoadSceneStep).SceneName == "test_scene"); }
public void TestCamTargetRotationCreate() { var builder = new StepBuilder(new MockEntitySupplier()); var zero = builder.BuildStep("cam => Joey"); var ten = builder.BuildStep("cam => Joey --low"); Assert.AreEqual("low", ((CameraTarget)ten).Pose); }
static void Main(string[] args) { IEnd builder = new StepBuilder() .Initialize() .LoadStuff() .Validate() .End(); }
protected Specification() { describe = new StepBuilder<Context>(this); context = new StepBuilder<Context>(this); it = new StepBuilder<Assertion>(this); Scenario = new StepBuilder<Context>(this, "Scenario: {0}"); Given = new StepBuilder<Activity>(this, "Given {0}"); When = new StepBuilder<Activity>(this, "When {0}"); Then = new StepBuilder<Assertion>(this, "Then {0}"); @_ = new CategoryBuilder(this); }
public void step(string keyword, string name, int line) { if (this.stepBuilder != null) { this.AddStepToElement(this.stepBuilder.GetResult()); } this.stepBuilder = new StepBuilder(new TableBuilder(), this.nativeLanguageService); this.stepBuilder.SetKeyword(keyword); this.stepBuilder.SetName(name); }
public void Get_ReleaseWithStageAndStepFound_ReleaseWithStageAndStepReturned() { //Arrange var request = new GetReleasesHttpRequestMessageBuilder().Build(); var expectedRelease = new ReleaseBuilder().Build(); var expectedEnvironment = new EnvironmentBuilder().Build(); var expectedStage = new StageBuilder().ForEnvironment(expectedEnvironment).Build(); var expectedStep = new StepBuilder() .ForRelease(expectedRelease) .ForStage(expectedStage) .Build(); var expectedDeploymentStep = new DeploymentStepBuilder() .ForRelease(expectedRelease) .ForStage(expectedStage) .ForStep(expectedStep) .Build(); var dataModel = new DataModelBuilder() .WithRelease(expectedRelease) .WithEnvironment(expectedEnvironment) .WithStage(expectedStage) .WithStageWorkflowFor(expectedRelease, expectedStage) .WithStep(expectedStep) .WithDeploymentStep(expectedDeploymentStep) .Build(); _releaseRepositoryMock.Setup((stub) => stub.GetReleaseData(It.IsAny<string>(), It.IsAny<int>())) .Returns(dataModel); //Act dynamic result = _sut.Get(request); //Assert Assert.IsNotNull(result, "Unexpected result"); Assert.IsInstanceOfType(result.releases, typeof(List<dynamic>), "Unexpected type for releases collection"); Assert.AreEqual(1, result.releases.Count, "Unexpected number of releases"); var actualRelease = result.releases[0]; AssertAreReleasesEqual(expectedRelease, actualRelease); Assert.IsInstanceOfType(actualRelease.stages, typeof(List<dynamic>), "Unexpected type for stages collection"); Assert.AreEqual(1, actualRelease.stages.Count, "Unexpected number of stages for release"); var actualStage = actualRelease.stages[0]; AssertAreStagesEqual(expectedStage, expectedEnvironment, actualStage); Assert.IsInstanceOfType(actualStage.steps, typeof(List<dynamic>), "Unexpected type for steps collection"); Assert.AreEqual(1, actualStage.steps.Count, "Unexpected number of steps for stage"); var actualStep = actualStage.steps[0]; AssertAreStepsEqual(expectedStep, actualStep); Assert.IsInstanceOfType(actualStep.deploymentSteps, typeof(List<dynamic>), "Unexpected type for deploymentStep collection"); Assert.AreEqual(1, actualStep.deploymentSteps.Count, "Unexpected number of steps for deploymentSteps"); AssertAreDeploymentStepsEqual(expectedDeploymentStep, actualStep.deploymentSteps[0]); }
public void Get_StageWithMultipleSteps_StepsAreOrderdByAttemptAndThenByRank() { //Arrange var request = new GetReleasesHttpRequestMessageBuilder().Build(); var expectedRelease = new ReleaseBuilder().Build(); var expectedEnvironment = new EnvironmentBuilder().Build(); var expectedStage = new StageBuilder().ForEnvironment(expectedEnvironment).Build(); var expectedStepBuilder = new StepBuilder().ForRelease(expectedRelease).ForStage(expectedStage); var expectedStepWithAttempt1AndRank1 = expectedStepBuilder.WithAttempt(1).WithRank(1).Build(); var expectedStepWithAttempt1AndRank2 = expectedStepBuilder.WithAttempt(1).WithRank(2).Build(); var expectedStepWithAttempt1AndRank3 = expectedStepBuilder.WithAttempt(1).WithRank(3).Build(); var expectedStepWithAttempt2AndRank1 = expectedStepBuilder.WithAttempt(2).WithRank(1).Build(); var expectedStepWithAttempt2AndRank2 = expectedStepBuilder.WithAttempt(2).WithRank(2).Build(); var dataModel = new DataModelBuilder() .WithRelease(expectedRelease) .WithEnvironment(expectedEnvironment) .WithStage(expectedStage) .WithStageWorkflowFor(expectedRelease, expectedStage) //add steps in 'random' order to check sorting of steps by attempt and then by rank .WithStep(expectedStepWithAttempt2AndRank2) .WithStep(expectedStepWithAttempt1AndRank2) .WithStep(expectedStepWithAttempt1AndRank1) .WithStep(expectedStepWithAttempt1AndRank3) .WithStep(expectedStepWithAttempt2AndRank1) .Build(); _releaseRepositoryMock.Setup((stub) => stub.GetReleaseData(It.IsAny<string>(), It.IsAny<int>())) .Returns(dataModel); //Act dynamic result = _sut.Get(request); //Assert Assert.IsNotNull(result, "Unexpected result"); var stage = result.releases[0].stages[0]; Assert.AreEqual(expectedStepWithAttempt1AndRank1.Id, stage.steps[0].id, "Unexpected first step"); Assert.AreEqual(expectedStepWithAttempt1AndRank2.Id, stage.steps[1].id, "Unexpected second step"); Assert.AreEqual(expectedStepWithAttempt1AndRank3.Id, stage.steps[2].id, "Unexpected third step"); Assert.AreEqual(expectedStepWithAttempt2AndRank1.Id, stage.steps[3].id, "Unexpected fourth step"); Assert.AreEqual(expectedStepWithAttempt2AndRank2.Id, stage.steps[4].id, "Unexpected fifth step"); }
private void CaptureAndStoreRemainingElements() { if (this.isInExample && this.exampleBuilder != null) { this.scenarioOutlineBuilder.AddExample(this.exampleBuilder.GetResult()); this.exampleBuilder = null; } if (this.featureElementState.IsBackgroundActive) { this.backgroundBuilder.AddStep(this.stepBuilder.GetResult()); this.theFeature.AddBackground(this.backgroundBuilder.GetResult()); } else if (this.featureElementState.IsScenarioActive) { if (this.stepBuilder != null) this.scenarioBuilder.AddStep(this.stepBuilder.GetResult()); this.theFeature.AddFeatureElement(this.scenarioBuilder.GetResult()); } else if (this.featureElementState.IsScenarioOutlineActive) { if (this.stepBuilder != null) this.scenarioOutlineBuilder.AddStep(this.stepBuilder.GetResult()); this.theFeature.AddFeatureElement(this.scenarioOutlineBuilder.GetResult()); } this.stepBuilder = null; this.scenarioBuilder = null; this.scenarioOutlineBuilder = null; this.backgroundBuilder = null; }