private static ScenarioStep ConvertToCompatibleStep(SpecFlowStep step)
        {
            ScenarioStep result = null;
            if (step.StepKeyword == StepKeyword.Given)
                result = new Given {StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.When)
                result = new When {StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.Then)
                result = new Then {StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.And)
                result = new And { StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.But)
                result = new But {StepKeyword = step.StepKeyword };

            if (result == null)
                throw new NotSupportedException();

            result.Keyword = step.Keyword;
            result.Text = step.Text;
            result.ScenarioBlock = step.ScenarioBlock;
            result.MultiLineTextArgument = step.Argument is global::Gherkin.Ast.DocString ? ((global::Gherkin.Ast.DocString) step.Argument).Content : null;
            result.TableArg = step.Argument is global::Gherkin.Ast.DataTable ? ConvertToCompatibleTable(((global::Gherkin.Ast.DataTable) step.Argument).Rows) : null;
            result.FilePosition = ConvertToCompatibleFilePosition(step.Location);

            return result;
        }
Example #2
0
        public void TestSmokeCreateNewTimeSeries()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .Then
            .CreatedTimeSeriesIsEqualToExpected();
        }
        public void ReturnSingle()
        {
            Given.OpenedPageWithBody(@"
                <ul>
                    <li class='item'>a</li>
                    <li class='item'>b</li>
                    <li class='item'>c</li>
                </ul>"
                                     );

            SeleneCollection elements = SS(".item");

            var element = elements.ActualWebElements.Single(e => e.Text == "c");

            Assert.AreEqual("c", element.Text);
        }
        public void ReturnDefaultFirst()
        {
            Given.OpenedPageWithBody(@"
                <p id='will-exist'>
                    <input id='ask' type='submit' value='How r u?' style='display:none'></input>
                    <input id='answer1' type='submit' value='Good!'></input>
                    <input id='answer2' type='submit' value='Great!'></input>
                </p>"
                                     );

            SeleneCollection elements = SS("div");

            var element = elements.ActualWebElements.FirstOrDefault();

            Assert.IsNull(element);
        }
        public void ReturnFirst()
        {
            Given.OpenedPageWithBody(@"
                <p id='will-exist'>
                    <input id='ask' type='submit' value='How r u?' style='display:none'></input>
                    <input id='answer1' type='submit' value='Good!'></input>
                    <input id='answer2' type='submit' value='Great!'></input>
                </p>"
                                     );

            SeleneCollection elements = SS("#will-exist>input");

            var element = elements.ActualWebElements.First();

            Assert.AreEqual("input", element.TagName);
        }
        public void ReturnCount()
        {
            Given.OpenedPageWithBody(@"
                <ul>
                    <li class='item'>a</li>
                    <li class='item'>a</li>
                    <li class='item'>a</li>
                </ul>"
                                     );

            SeleneCollection elements = SS(".item");

            var count = elements.ActualWebElements.Count();

            Assert.AreEqual(3, count);
        }
        public void ReturnDefaultSingle()
        {
            Given.OpenedPageWithBody(@"
                <ul>
                    <li class='item'>a</li>
                    <li class='item'>a</li>
                    <li class='item'>a</li>
                </ul>"
                                     );

            SeleneCollection elements = SS(".item");

            var element = elements.ActualWebElements.SingleOrDefault(e => e.Text == "b");

            Assert.IsNull(element);
        }
        public void ReturnSelect()
        {
            Given.OpenedPageWithBody(@"
                <ul>
                    <li class='item'>a</li>
                    <li class='item'>b</li>
                </ul>"
                                     );

            SeleneCollection elements = SS(".item");

            var selectedElements = elements.ActualWebElements.Select(e => e.Text == "b");

            Assert.AreEqual(false, selectedElements.First());
            Assert.AreEqual(true, selectedElements.Last());
        }
Example #9
0
            public void WhenAccountDoesNotHaveEnoughFunds_ShouldInvalidOperationException()
            {
                Given.ValidAccountExistsInDatabase(FromAccount);
                And.UserIsAuthorisedToWithdraw(FromAccount, User);
                And.AccountDoesNotHaveEnoughFundsForWithdrawal(FromAccount, WithdrawalAmount);

                Func <Task> whenIWithdraw = async() =>
                {
                    await SUT.Withdraw(WithdrawalAmount, FromAccount, User);
                };

                whenIWithdraw
                .Then()
                .Throw <InvalidOperationException>("because account's balance is less then the withdrawal amount")
                .WithMessage($"Not enough money on account '{FromAccount}'");
            }
Example #10
0
            public void WhenUserDoesNotHaveAccessToAccount_ShouldThrowArgumentException()
            {
                Given.ValidAccountExistsInDatabase(FromAccount);
                And.ValidAccountExistsInDatabase(ToAccount);
                And.UserIsNotAuthorisedToWithdraw(FromAccount, User);

                Func <Task> whenITransferMoney = async() =>
                {
                    await SUT.TransferMoney(WithdrawalAmount, FromAccount, ToAccount, User);
                };

                whenITransferMoney
                .Then()
                .Throw <NotAuthorizedException>("because user have not being authorized to withdraw")
                .Where(x => x.AccountNumber == FromAccount && x.UserName == User.Name);
            }
Example #11
0
        public void ShouldUseMultipleUnregisteredConstructorArgument()
        {
            locator.Register(Given <ITestInterface> .Then <DependsOnMultipleInterface>());

            var argument  = new ConstructorArgument();
            var argument2 = new ConstructorArgument();
            var instance  = locator.GetInstance <ITestInterface>(new ConstructorParameter {
                Name = "argument1", Value = argument
            },
                                                                 new ConstructorParameter {
                Name = "argument2", Value = argument2
            });

            Assert.AreSame(argument, ((DependsOnMultipleInterface)instance).Argument);
            Assert.AreSame(argument2, ((DependsOnMultipleInterface)instance).Argument2);
        }
Example #12
0
        public void TestCreateNewTimeSeriesDateCreated(string date)
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Name        = TestStringHelper.RandomLatinString(),
                DateCreated = date,
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .Then
            .CreatedTimeSeriesIsEqualToExpected();
        }
        public void ReturnDefaultLast()
        {
            Given.OpenedPageWithBody(@"
                <ul>
                    <li class='item'>a</li>
                    <li class='item'>b</li>
                    <li class='item'>c</li>
                </ul>"
                                     );

            SeleneCollection elements = SS("div");

            var element = elements.ActualWebElements.LastOrDefault();

            Assert.IsNull(element);
        }
Example #14
0
        public async Task CanQueryForSuccessors()
        {
            var airlineDay = await j.Fact(new AirlineDay(new Airline("IA"), DateTime.Today));

            var flight = await j.Fact(new Flight(airlineDay, 4247));

            var specification = Given <AirlineDay> .Match((airlineDay, facts) =>
                                                          from flight in facts.OfType <Flight>()
                                                          where flight.airlineDay == airlineDay
                                                          select flight
                                                          );

            var flights = await j.Query(airlineDay, specification);

            flights.Should().ContainSingle().Which.Should().BeEquivalentTo(flight);
        }
Example #15
0
        public void ShouldUseUnregisteredIntArgument()
        {
            var argument  = 1;
            var arguments = new List <IResolutionArgument>
            {
                new ConstructorParameter {
                    Name = "argument", Value = argument
                }
            };

            locator.Register(Given <DependsOnType <int> > .Then <DependsOnType <int> >());
            locator.Register(Given <DependsOnType <int> > .ConstructWith(arguments));
            var instance = locator.GetInstance <DependsOnType <int> >();

            Assert.AreEqual(argument, instance.Argument);
        }
Example #16
0
        public void RemovesObjectsWhenRemovingNodesBelowThem()
        {
            Given
            .ObjectAt(ObjectType, _position1)
            .ObjectAt(ObjectType, _position2)
            .ConnectionBetween(_position1, _position2);

            When
            .ListeningToEvents()
            .RemovingConnectionBetween(_position1, _position2);

            Then
            .ShouldNotHaveObjects(ObjectType)
            .ShouldHaveCalled(x => x
                              .Removed(ObjectType, _position1)
                              .Removed(ObjectType, _position2));
        }
Example #17
0
        public void Exec_WithInvalidData_PrintsValidationError_UsingValidatorFromDI()
        {
            var scenario = new Given <App>
            {
                And      = { Dependencies = { new PersonValidator() } },
                WhenArgs = "Save",
                Then     =
                {
                    ExitCode = 2,
                    Result   = @"'Id' must be greater than '0'.
'Name' should not be empty.
'Email' should not be empty."
                }
            };

            _verifier.VerifyScenario(scenario);
        }
        public void DoubleClick_IsRenderedInError_OnHiddenFailure()
        {
            Configuration.Timeout         = 0.25;
            Configuration.PollDuringWaits = 0.1;
            Given.OpenedPageWithBody(
                @"
                <span 
                  id='link' 
                  ondblclick='window.location=this.href + ""#second""' 
                  style='display:none'
                >to h2</span>
                <h2 id='second'>Heading 2</h2>
                "
                );
            var beforeCall = DateTime.Now;

            try
            {
                S("span").DoubleClick();
                Assert.Fail("should fail with exception");
            }

            catch (TimeoutException error)
            {
                var afterCall = DateTime.Now;
                Assert.Greater(afterCall, beforeCall.AddSeconds(0.25));
                Assert.Less(afterCall, beforeCall.AddSeconds(1.0));

                var lines = error.Message.Split("\n").Select(
                    item => item.Trim()
                    ).ToList();

                Assert.Contains("Timed out after 0.25s, while waiting for:", lines);
                Assert.Contains(
                    "Browser.Element(span).Actions.DoubleClick(self.ActualWebElement).Perform()",
                    lines
                    );
                Assert.Contains("Reason:", lines);
                Assert.Contains(
                    "element not interactable: [object HTMLSpanElement] has no size and location",
                    lines
                    );

                StringAssert.DoesNotContain("second", Configuration.Driver.Url);
            }
        }
Example #19
0
        public void ShouldChangeImplementationWhenContextIsAdded()
        {
            locator
            .Register(Given <ITestInterface> .Then <TestCase1>())
            .Register(Given <ITestInterface>
                      .When <TestContext>(context => context.TestCases == TestEnum.Case2)
                      .Then <TestCase2>())
            .Register(Given <ITestInterface>
                      .When <TestContext>(context => context.TestCases == TestEnum.Case1)
                      .Then <TestCase1>());

            Assert.IsInstanceOf <TestCase1>(locator.GetInstance <ITestInterface>());

            locator.AddContext(CreateContext(TestEnum.Case2));

            Assert.IsInstanceOf <TestCase2>(locator.GetInstance <ITestInterface>());
        }
Example #20
0
        public void Submit_Waits_For_NoOverlay_WhenCustomized()
        {
            Configuration.Timeout         = 0.6;
            Configuration.PollDuringWaits = 0.1;
            Given.OpenedPageWithBody(
                @"
                <div 
                    id='overlay' 
                    style='
                        display:block;
                        position: fixed;
                        display: block;
                        width: 100%;
                        height: 100%;
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                        background-color: rgba(0,0,0,0.1);
                        z-index: 2;
                        cursor: pointer;
                    '
                >
                </div>

                <form action='#second'>go to Heading 2</form>
                <h2 id='second'>Heading 2</h2>
                "
                );
            var beforeCall = DateTime.Now;

            Given.ExecuteScriptWithTimeout(
                @"
                document.getElementById('overlay').style.display = 'none';
                ",
                300
                );

            S("form").With(waitByJsForNotOverlapped: true).Submit(); // TODO: this overlay works only for "overlayying at center of element", handle the "partial overlay" cases too!

            var afterCall = DateTime.Now;

            Assert.Greater(afterCall, beforeCall.AddSeconds(0.3));
            Assert.Less(afterCall, beforeCall.AddSeconds(0.6));
            Assert.IsTrue(Configuration.Driver.Url.Contains("second"));
        }
        public void UpdateSearch_OnNextActualActionLikeQuestioiningCount()
        {
            Given.OpenedEmptyPage();
            var elements = SS("li").FilterBy(Be.Visible);

            When.WithBody(@"
                <ul>Hello to:
                    <li class='will-appear' style='display:none'>Miller</li>
                    <li class='will-appear' style='display:none'>Julie Mao</li>
                </ul>"
                          );
            Assert.AreEqual(0, elements.Count);
            Selene.ExecuteScript(@"
                document.getElementsByTagName('li')[0].style = 'display:block';"
                                 );
            Assert.AreEqual(1, elements.Count);
        }
Example #22
0
        public void AllwaysReturnsBoolWithoutWaiting()
        {
            var beforeCall = DateTime.Now;

            Given.OpenedPageWithBody("<p id='existing'>Hello!</p>");

            // EXPECT
            Assert.IsFalse(SS("#absent").Matching(Have.Count(2)));
            Assert.IsTrue(SS("#absent").Matching(Have.No.Count(2)));

            Assert.IsTrue(SS("#existing").Matching(Have.Count(1)));
            Assert.IsFalse(SS("#existing").Matching(Have.No.Count(1)));

            var afterCall = DateTime.Now;

            Assert.IsTrue(afterCall < beforeCall.AddSeconds(Configuration.Timeout / 2));
        }
Example #23
0
        public void TestCreateNewProfileWithGuid()
        {
            var profile = new TestUserModel
            {
                Email     = $"{Guid.NewGuid().ToString()}@example.com",
                Password  = Guid.NewGuid().ToString(),
                FirstName = Guid.NewGuid().ToString(),
                LastName  = Guid.NewGuid().ToString(),
            };

            Given
            .NewUserData(profile)
            .When
            .CreateUserRequestIsSend()
            .Then
            .ResponseHasCode(HttpStatusCode.BadRequest);
        }
        public void TestSmokeUploadTimeSeriesData()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .UploadTimeSeriesDataRequestIsSend("2021-01-10 11:14,1\n2021-01-10 11:16,3")
            .Then
            .LastRequestSuccessful();
        }
        public void TestSmokeGetAllTimeSeries()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .GetAllTimeSeriesRequestIsSend()
            .Then
            .TimeSeriesIsPresentInUserTimeSeries(timeSeries);
        }
Example #26
0
 public void InitPageLoadingForTests()
 {
     Given.OpenedPageWithBody(@"
         <h2 id='second'>Heading 2</h2>"
                              , driver
                              );
     When.WithBodyTimedOut(@"
         <a href='#second' style='display:none'>go to Heading 2</a>
         <h2 id='second'>Heading 2</h2>"
                           , 250, driver
                           );
     When.ExecuteScriptWithTimeout(@"
         document.getElementsByTagName('a')[0].style = 'display:block';
         ",
                                   500, driver
                                   );
 }
Example #27
0
        public void Clear_WorksUnderOverlay_ByDefault()
        {
            Configuration.Timeout         = 1.0;
            Configuration.PollDuringWaits = 0.1;
            Given.OpenedPageWithBody(
                @"
                <div 
                    id='overlay' 
                    style='
                        display:block;
                        position: fixed;
                        display: block;
                        width: 100%;
                        height: 100%;
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                        background-color: rgba(0,0,0,0.1);
                        z-index: 2;
                        cursor: pointer;
                    '
                >
                </div>

                <input value='abracadabra'></input>
                "
                );
            var beforeCall = DateTime.Now;

            S("input").Clear();

            var afterCall = DateTime.Now;

            Assert.Less(afterCall, beforeCall.AddSeconds(0.5));
            Assert.AreEqual(
                "",
                Configuration.Driver
                .FindElement(By.TagName("input")).GetAttribute("value")
                );
            Assert.AreEqual(
                "",
                Configuration.Driver
                .FindElement(By.TagName("input")).GetProperty("value")
                );
        }
Example #28
0
        public async Task Optimization_RunPipelineOnGraph()
        {
            var userWithName = Given <PassengerName> .Match(passengerName =>
                                                            passengerName.passenger.user);

            var pipeline      = userWithName.Pipeline;
            var passenger     = new Passenger(new Airline("IA"), new User("--- PUBLIC KEY ---"));
            var passengerName = new PassengerName(passenger, "George", new PassengerName[0]);

            // This instance does not contain the facts.
            var j     = JinagaTest.Create();
            var users = await j.Query(passengerName, userWithName);

            // But the graph does.
            users.Should().ContainSingle().Which
            .publicKey.Should().Be("--- PUBLIC KEY ---");
        }
Example #29
0
        public void TestSmokeGetTimeSeriesMetadataById()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .GetTimeSeriesMetadataByIdRequestIsSend(timeSeries.Id)
            .Then
            .TimeSeriesByIdIsEqualTo(timeSeries);
        }
Example #30
0
        public void ShouldChooseTestService2()
        {
            locator
            .Register(Given <ITestController> .Then <TestController>())
            .Register(Given <ITestRepository> .Then <TestRepository1>())
            .Register(Given <IBaseService>
                      .When <ITestCondition>(context => context.TestType == TestTypes.Test1)
                      .Then <TestService1>())
            .Register(Given <IBaseService>
                      .When <ITestCondition>(context => context.TestType == TestTypes.Test2)
                      .Then <TestService2>());

            locator.AddContext(new TestCondition(TestTypes.Test2));
            var controller = locator.GetInstance <ITestController>();

            Assert.IsInstanceOf <TestService2>(controller.Service);
        }
Example #31
0
        public void Click_Waits_For_NoOverlay()
        {
            Configuration.Timeout         = 0.6;
            Configuration.PollDuringWaits = 0.1;
            Given.OpenedPageWithBody(
                @"
                <div 
                    id='overlay' 
                    style='
                        display:block;
                        position: fixed;
                        display: block;
                        width: 100%;
                        height: 100%;
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                        background-color: rgba(0,0,0,0.1);
                        z-index: 2;
                        cursor: pointer;
                    '
                >
                </div>

                <a id='link' href='#second' style='display:block'>go to Heading 2</a>
                <h2 id='second'>Heading 2</h2>
                "
                );
            var beforeCall = DateTime.Now;

            Given.ExecuteScriptWithTimeout(
                @"
                document.getElementById('overlay').style.display = 'none';
                ",
                300
                );

            S("a").Click();

            var afterCall = DateTime.Now;

            Assert.Greater(afterCall, beforeCall.AddSeconds(0.3));
            Assert.Less(afterCall, beforeCall.AddSeconds(0.6));
            Assert.IsTrue(Configuration.Driver.Url.Contains("second"));
        }
        private ScenarioStep CloneTo(ScenarioStep step, string currentBlock)
        {
            ScenarioStep newStep = null;
            if (currentBlock == "When")
                newStep = new When();
            else if (currentBlock == "Then")
                newStep = new Then();
            else // Given or empty
                newStep = new Given();

            Debug.Assert(newStep != null);

            newStep.Text = step.Text;
            newStep.MultiLineTextArgument = step.MultiLineTextArgument;
            newStep.TableArg = Clone(step.TableArg);
            return newStep;
        }
        private ScenarioStep Clone(ScenarioStep step)
        {
            ScenarioStep newStep = null;
            if (step is Given)
                newStep = new Given();
            else if (step is When)
                newStep = new When();
            else if (step is Then)
                newStep = new Then();
            else if (step is And)
                newStep = new And();
            else if (step is But)
                newStep = new But();

            Debug.Assert(newStep != null);

            newStep.Text = step.Text;
            newStep.MultiLineTextArgument = step.MultiLineTextArgument;
            newStep.TableArg = Clone(step.TableArg);
            return newStep;
        }
    // $ANTLR end "steps"


    // $ANTLR start "step"
    // SpecFlowLangWalker.g:156:1: step returns [ScenarioStep step] : ( ^( GIVEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( WHEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( THEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( AND text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( BUT text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) );
    public ScenarioStep step() // throws RecognitionException [1]
    {   
        ScenarioStep step = default(ScenarioStep);

        Text text_ = default(Text);

        MultilineText mlt_ = default(MultilineText);

        Table table_ = default(Table);

        FilePosition fp_ = default(FilePosition);


        try 
    	{
            // SpecFlowLangWalker.g:160:5: ( ^( GIVEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( WHEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( THEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( AND text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( BUT text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) )
            int alt24 = 5;
            switch ( input.LA(1) ) 
            {
            case GIVEN:
            	{
                alt24 = 1;
                }
                break;
            case WHEN:
            	{
                alt24 = 2;
                }
                break;
            case THEN:
            	{
                alt24 = 3;
                }
                break;
            case AND:
            	{
                alt24 = 4;
                }
                break;
            case BUT:
            	{
                alt24 = 5;
                }
                break;
            	default:
            	    NoViableAltException nvae_d24s0 =
            	        new NoViableAltException("", 24, 0, input);

            	    throw nvae_d24s0;
            }

            switch (alt24) 
            {
                case 1 :
                    // SpecFlowLangWalker.g:160:9: ^( GIVEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,GIVEN,FOLLOW_GIVEN_in_step1055); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1071);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:162:17: (mlt_= multilineText )?
                    	int alt14 = 2;
                    	int LA14_0 = input.LA(1);

                    	if ( (LA14_0 == MULTILINETEXT) )
                    	{
                    	    alt14 = 1;
                    	}
                    	switch (alt14) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:162:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1087);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:163:19: (table_= table )?
                    	int alt15 = 2;
                    	int LA15_0 = input.LA(1);

                    	if ( (LA15_0 == TABLE) )
                    	{
                    	    alt15 = 1;
                    	}
                    	switch (alt15) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:163:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1104);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1121);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new Given(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 2 :
                    // SpecFlowLangWalker.g:169:9: ^( WHEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,WHEN,FOLLOW_WHEN_in_step1152); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1168);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:171:17: (mlt_= multilineText )?
                    	int alt16 = 2;
                    	int LA16_0 = input.LA(1);

                    	if ( (LA16_0 == MULTILINETEXT) )
                    	{
                    	    alt16 = 1;
                    	}
                    	switch (alt16) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:171:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1184);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:172:19: (table_= table )?
                    	int alt17 = 2;
                    	int LA17_0 = input.LA(1);

                    	if ( (LA17_0 == TABLE) )
                    	{
                    	    alt17 = 1;
                    	}
                    	switch (alt17) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:172:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1201);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1218);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new When(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 3 :
                    // SpecFlowLangWalker.g:178:9: ^( THEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,THEN,FOLLOW_THEN_in_step1249); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1265);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:180:17: (mlt_= multilineText )?
                    	int alt18 = 2;
                    	int LA18_0 = input.LA(1);

                    	if ( (LA18_0 == MULTILINETEXT) )
                    	{
                    	    alt18 = 1;
                    	}
                    	switch (alt18) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:180:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1281);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:181:19: (table_= table )?
                    	int alt19 = 2;
                    	int LA19_0 = input.LA(1);

                    	if ( (LA19_0 == TABLE) )
                    	{
                    	    alt19 = 1;
                    	}
                    	switch (alt19) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:181:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1298);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1315);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new Then(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 4 :
                    // SpecFlowLangWalker.g:187:9: ^( AND text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,AND,FOLLOW_AND_in_step1346); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1362);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:189:17: (mlt_= multilineText )?
                    	int alt20 = 2;
                    	int LA20_0 = input.LA(1);

                    	if ( (LA20_0 == MULTILINETEXT) )
                    	{
                    	    alt20 = 1;
                    	}
                    	switch (alt20) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:189:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1378);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:190:19: (table_= table )?
                    	int alt21 = 2;
                    	int LA21_0 = input.LA(1);

                    	if ( (LA21_0 == TABLE) )
                    	{
                    	    alt21 = 1;
                    	}
                    	switch (alt21) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:190:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1395);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1412);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new And(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 5 :
                    // SpecFlowLangWalker.g:196:9: ^( BUT text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,BUT,FOLLOW_BUT_in_step1443); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1459);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:198:17: (mlt_= multilineText )?
                    	int alt22 = 2;
                    	int LA22_0 = input.LA(1);

                    	if ( (LA22_0 == MULTILINETEXT) )
                    	{
                    	    alt22 = 1;
                    	}
                    	switch (alt22) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:198:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1475);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:199:19: (table_= table )?
                    	int alt23 = 2;
                    	int LA23_0 = input.LA(1);

                    	if ( (LA23_0 == TABLE) )
                    	{
                    	    alt23 = 1;
                    	}
                    	switch (alt23) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:199:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1492);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1509);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new But(text_, mlt_, table_);
                    	        

                    }
                    break;

            }

                step.FilePosition = fp_;

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return step;
    }
Example #35
0
        public ScenarioStep CreateStep(string keyword, StepKeyword stepKeyword, string text, FilePosition position, ScenarioBlock scenarioBlock)
        {
            ScenarioStep step;
            switch (stepKeyword)
            {
                case StepKeyword.Given:
                    step = new Given();
                    break;
                case StepKeyword.When:
                    step = new When();
                    break;
                case StepKeyword.Then:
                    step = new Then();
                    break;
                case StepKeyword.And:
                    step = new And();
                    break;
                case StepKeyword.But:
                    step = new But();
                    break;
                default:
                    throw new NotSupportedException();
            }

            step.Keyword = keyword;
            step.Text = text;
            step.FilePosition = position;
            step.ScenarioBlock = scenarioBlock;
            step.StepKeyword = stepKeyword;
            return step;
        }