コード例 #1
0
        /// <summary>
        /// Shines the spotlight upon an actor, such that they will now be returned by <see cref="GetTheActorInTheSpotlight"/>.
        /// This essentially marks them the subject of future test logic.
        /// </summary>
        /// <returns>The actor who has just been placed into the spotlight.</returns>
        /// <typeparam name="TPersona">The persona type.</typeparam>
        public IActor ShineTheSpotlightOn <TPersona>() where TPersona : class, IPersona, new()
        {
            var actor = cast.Get <TPersona>();

            ShineTheSpotlightOn(actor);
            return(actor);
        }
コード例 #2
0
        public void AprilOverridesTheApplicationVersionNumber(string versionNumber)
        {
            var april = cast.Get <April>();

            stage.ShineTheSpotlightOn(april);
            Given(april).WasAbleTo(OverrideTheApplicationVersion.To(versionNumber));
        }
コード例 #3
0
ファイル: FindATicketSteps.cs プロジェクト: csf-dev/agiil
        public void GivenYoussefLooksAtTheListOfTickets()
        {
            var youssef = cast.Get <Youssef>();

            stage.ShineTheSpotlightOn(youssef);
            Given(youssef).WasAbleTo(OpenTheirBrowserOn.ThePage <TicketList>());
        }
コード例 #4
0
ファイル: SprintViewingSteps.cs プロジェクト: csf-dev/agiil
        public void GivenYoussefHasOpenedTheSprintListingPage()
        {
            var youssef = cast.Get <Youssef>();

            stage.ShineTheSpotlightOn(youssef);
            Given(youssef).WasAbleTo(OpenTheirBrowserOn.ThePage(SprintList.ForOpenSprints()));
        }
コード例 #5
0
        public void GivenYoussefHasNavigatedToTheTicketWithTheTitle(string title)
        {
            var youssef = cast.Get <Youssef>();

            stage.ShineTheSpotlightOn(youssef);
            Given(youssef).WasAbleTo(OpenTheTicket.Titled(title));
        }
コード例 #6
0
ファイル: PasswordChangeSteps.cs プロジェクト: csf-dev/agiil
        public void WhenYoussefChangesHisPassword(string newPassword)
        {
            var youssef = cast.Get <Youssef>();

            stage.ShineTheSpotlightOn(youssef);
            When(youssef).AttemptsTo(ChangeTheirPassword.From(Youssef.Password).To(newPassword));
        }
コード例 #7
0
ファイル: LoginSteps.cs プロジェクト: csf-dev/agiil
        public void WhenJoeAttemptsToLogin(string username, string password)
        {
            var joe = cast.Get <Joe>();

            stage.ShineTheSpotlightOn(joe);

            When(joe).AttemptsTo(LogIntoTheSite.As(username).WithThePassword(password));
        }
コード例 #8
0
ファイル: WebBrowsingSteps.cs プロジェクト: csf-dev/agiil
        public void GivenJoeIsLookingAtTheAppHomePage()
        {
            // Currently bugged due to https://github.com/csf-dev/CSF.Screenplay/issues/126
            //testRunner.Value.Given("Joe can browse the web");
            resolver.Resolve <JoeSteps>().GivenJoeCanBrowseTheWeb();

            var joe = cast.Get <Joe>();

            Given(joe).WasAbleTo <VisitTheHomePage>();
        }
コード例 #9
0
        public void GivenAprilAddsAUserAccount(string username, string password)
        {
            // Currently bugged due to https://github.com/csf-dev/CSF.Screenplay/issues/126
            //testRunner.Value.Given("April can act as the application");
            resolver.Resolve <AprilSteps>().GivenAprilCanActAsTheApplication();

            var april = cast.Get <April>();

            Given(april).WasAbleTo(AddAUserAccount.WithTheUsername(username).AndThePassword(password));
        }
コード例 #10
0
ファイル: YoussefSteps.cs プロジェクト: csf-dev/agiil
        public void GivenYoussefCanBrowseTheWeb()
        {
            var youssef = cast.Get <Youssef>();

            if (youssef.HasAbility <BrowseTheWeb>())
            {
                return;
            }

            youssef.IsAbleTo(browseTheWeb);
        }
コード例 #11
0
ファイル: CreateSprintSteps.cs プロジェクト: csf-dev/agiil
        public void GivenYoussefHasOpenedTheNewSprintPage()
        {
            var youssef = cast.Get <Youssef>();

            stage.ShineTheSpotlightOn(youssef);
            Given(youssef).WasAbleTo(OpenTheirBrowserOn.ThePage <CreateSprint>());
        }
コード例 #12
0
        public void GivenJoeHasAStopwatch()
        {
            var joe = cast.Get("Joe");

            joe.IsAbleTo <UseAStopwatch>();
            stage.ShineTheSpotlightOn(joe);
        }
コード例 #13
0
        public void WhenYoussefCreatesATicket(Table detailsTable)
        {
            var details = detailsTable.CreateInstance <TicketCreationDetails>();

            var youssef = cast.Get <Youssef>();

            stage.ShineTheSpotlightOn(youssef);
            When(youssef).AttemptsTo(CreateANewTicket.WithTheDetails(details));
        }
コード例 #14
0
        public void Using_GetDataSlowly_does_not_raise_exception_if_timeout_is_30_seconds(ICast cast)
        {
            // Arrange
            var joe = cast.Get <Joe>();

            // Act & assert
            Assert.That(() => When(joe).AttemptsTo(Invoke.TheJsonWebService(SlowlyGetData.For(joe.Name)).WithATimeoutOf(30).Seconds().AndReadTheResultAs <SampleApiData>()),
                        Throws.Nothing);
        }
コード例 #15
0
        public void GivenAgiilHasJustBeenInstalled()
        {
            // Currently bugged due to https://github.com/csf-dev/CSF.Screenplay/issues/126
            // testRunner.Value.Given("April can act as the application");
            aprilSteps.Value.GivenAprilCanActAsTheApplication();

            var april = cast.Get <April>();

            Given(april).WasAbleTo <InstallTheApplication>();
        }
コード例 #16
0
ファイル: ProjectSetupSteps.cs プロジェクト: csf-dev/agiil
        public void GivenAprilHasSetUpTheSimpleSampleProject()
        {
            // Currently bugged due to https://github.com/csf-dev/CSF.Screenplay/issues/126
            // testRunner.Value.Given("April can act as the application");
            aprilSteps.Value.GivenAprilCanActAsTheApplication();

            var april = cast.Get <April>();

            Given(april).WasAbleTo <SetupTheSimpleSampleProject>();
        }
コード例 #17
0
        public void A_new_item_can_be_added_to_an_empty_list(ICast cast, BrowseTheWeb browseTheWeb)
        {
            var joe = cast.Get("Joe");

            joe.IsAbleTo(browseTheWeb);

            Given(joe).WasAbleTo(OpenTheirBrowserOn.ThePage <HomePage>());
            When(joe).AttemptsTo(Enter.TheText("*****@*****.**").Into(HomePage.EmalInput));

            // The rest of the test is unchanged
        }
コード例 #18
0
ファイル: JoeSteps.cs プロジェクト: csf-dev/agiil
        public void GivenJoeCanBrowseTheWeb()
        {
            var joe = cast.Get <Joe>();

            if (joe.HasAbility <BrowseTheWeb>())
            {
                return;
            }

            joe.IsAbleTo(browseTheWeb);
        }
コード例 #19
0
        public void Using_CheckData_does_not_raise_exception_for_valid_data(ICast cast)
        {
            // Arrange
            var joe     = cast.Get <Joe>();
            var theData = new SampleApiData {
                Name = ExecutionController.ValidName, DateAndTime = DateTime.Today
            };

            // Act & assert
            Assert.That(() => When(joe).AttemptsTo(Invoke.TheJsonWebService <CheckData>().WithTheData(theData).AndVerifyItSucceeds()), Throws.Nothing);
        }
コード例 #20
0
        public void GivenAprilCanActAsTheApplication()
        {
            var april = cast.Get <April>();

            if (april.HasAbility <ConsumeWebServices>())
            {
                return;
            }

            april.IsAbleTo(actAsTheApplication);
        }
コード例 #21
0
        public void Using_SetTheNumber_does_not_raise_exception(ICast cast)
        {
            // Arrange
            var joe     = cast.Get <Joe>();
            var theData = new SampleApiData()
            {
                NewNumber = 5
            };

            // Act & assert
            Assert.That(() => When(joe).AttemptsTo(Invoke.TheJsonWebService <SetNumber>().WithTheData(theData).AndVerifyItSucceeds()), Throws.Nothing);
        }
コード例 #22
0
        public void Using_CheckData_raises_exception_for_invalid_data(ICast cast)
        {
            // Arrange
            var joe     = cast.Get <Joe>();
            var theData = new SampleApiData {
                Name = "Invalid, crash expected", DateAndTime = DateTime.Today
            };

            // Act & assert
            Assert.That(() => When(joe).AttemptsTo(Invoke.TheJsonWebService <CheckData>().WithTheData(theData).AndVerifyItSucceeds()),
                        Throws.InstanceOf <WebApiException>());
        }
コード例 #23
0
        public void Using_GetData_returns_expected_result(ICast cast)
        {
            // Arrange
            var joe = cast.Get <Joe>();

            // Act
            var result = When(joe).AttemptsTo(Invoke.TheJsonWebService(GetData.For(joe.Name)).AndReadTheResultAs <SampleApiData>());

            // Assert
            Assert.That(result, Is.Not.Null, "Result should not be null");
            Assert.That(result.Name, Is.EqualTo(joe.Name), "Result name should be as expected");
            Assert.That(result.DateAndTime, Is.EqualTo(DataController.SampleDateTime), "Result date should be as expected");
        }
コード例 #24
0
    public void A_new_item_can_be_added_to_an_empty_list(ICast cast, BrowseTheWeb browseTheWeb)
    {
        var joe = cast.Get("Joe");

        joe.IsAbleTo(browseTheWeb);

        // Given Joe opens an empty to-do list
        Given(joe).WasAbleTo <OpenAnEmptyToDoList>();

        // When Joe adds a new item called "Wash dishes"
        When(joe).AttemptsTo(AddAToDoItem.Named("Wash dishes"));

        // Then the top item should be called "Wash dishes"
        var theText = Then(joe).ShouldRead(TheTopToDoItem.FromTheList());

        Assert.That(theText, Is.EqualTo("Wash dishes"));
    }
コード例 #25
0
        public void Using_SetTheNumber_then_GetTheNumber_returns_the_correct_number(ICast cast)
        {
            // Arrange
            var theNumber = 42;
            var theData   = new SampleApiData()
            {
                NewNumber = theNumber
            };
            var joe = cast.Get <Joe>();

            Given(joe).WasAbleTo(Invoke.TheJsonWebService <SetNumber>().WithTheData(theData).AndVerifyItSucceeds());

            // Act
            var result = When(joe).AttemptsTo(Invoke.TheJsonWebService <GetNumber>().AndReadTheResultAs <int>());

            // Assert
            Assert.That(result, Is.EqualTo(theNumber));
        }
コード例 #26
0
    public void A_new_item_is_added_to_the_top_of_the_list(ICast cast, BrowseTheWeb browseTheWeb)
    {
        var joe = cast.Get("Joe");

        joe.IsAbleTo(browseTheWeb);

        // Given Joe opens an empty to-do list
        Given(joe).WasAbleTo <OpenAnEmptyToDoList>();
        // And he has added an item called "Buy bread"
        Given(joe).WasAbleTo(AddAToDoItem.Named("Buy bread"));

        // When Joe adds a new item called "Buy shampoo"
        When(joe).AttemptsTo(AddAToDoItem.Named("Buy shampoo"));

        // Then the top item should be called "Buy shampoo"
        var theText = Then(joe).ShouldRead(TheTopToDoItem.FromTheList());

        Assert.That(theText, Is.EqualTo("Buy shampoo"));
    }
コード例 #27
0
        public void GivenSarahIsAnActorFromAPersona()
        {
            var sarah = cast.Get <Sarah>();

            stage.ShineTheSpotlightOn(sarah);
        }
コード例 #28
0
 public static IActor GetMathsWhiz(this ICast cast, string name)
 {
     return(cast.Get(name, CustomiseActor));
 }
コード例 #29
0
        public void GivenJoeIsAnActorInTheSpotlight()
        {
            var joe = cast.Get("Joe");

            stage.ShineTheSpotlightOn(joe);
        }