/// <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); }
public void AprilOverridesTheApplicationVersionNumber(string versionNumber) { var april = cast.Get <April>(); stage.ShineTheSpotlightOn(april); Given(april).WasAbleTo(OverrideTheApplicationVersion.To(versionNumber)); }
public void GivenYoussefLooksAtTheListOfTickets() { var youssef = cast.Get <Youssef>(); stage.ShineTheSpotlightOn(youssef); Given(youssef).WasAbleTo(OpenTheirBrowserOn.ThePage <TicketList>()); }
public void GivenYoussefHasOpenedTheSprintListingPage() { var youssef = cast.Get <Youssef>(); stage.ShineTheSpotlightOn(youssef); Given(youssef).WasAbleTo(OpenTheirBrowserOn.ThePage(SprintList.ForOpenSprints())); }
public void GivenYoussefHasNavigatedToTheTicketWithTheTitle(string title) { var youssef = cast.Get <Youssef>(); stage.ShineTheSpotlightOn(youssef); Given(youssef).WasAbleTo(OpenTheTicket.Titled(title)); }
public void WhenYoussefChangesHisPassword(string newPassword) { var youssef = cast.Get <Youssef>(); stage.ShineTheSpotlightOn(youssef); When(youssef).AttemptsTo(ChangeTheirPassword.From(Youssef.Password).To(newPassword)); }
public void WhenJoeAttemptsToLogin(string username, string password) { var joe = cast.Get <Joe>(); stage.ShineTheSpotlightOn(joe); When(joe).AttemptsTo(LogIntoTheSite.As(username).WithThePassword(password)); }
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>(); }
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)); }
public void GivenYoussefCanBrowseTheWeb() { var youssef = cast.Get <Youssef>(); if (youssef.HasAbility <BrowseTheWeb>()) { return; } youssef.IsAbleTo(browseTheWeb); }
public void GivenYoussefHasOpenedTheNewSprintPage() { var youssef = cast.Get <Youssef>(); stage.ShineTheSpotlightOn(youssef); Given(youssef).WasAbleTo(OpenTheirBrowserOn.ThePage <CreateSprint>()); }
public void GivenJoeHasAStopwatch() { var joe = cast.Get("Joe"); joe.IsAbleTo <UseAStopwatch>(); stage.ShineTheSpotlightOn(joe); }
public void WhenYoussefCreatesATicket(Table detailsTable) { var details = detailsTable.CreateInstance <TicketCreationDetails>(); var youssef = cast.Get <Youssef>(); stage.ShineTheSpotlightOn(youssef); When(youssef).AttemptsTo(CreateANewTicket.WithTheDetails(details)); }
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); }
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>(); }
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>(); }
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 }
public void GivenJoeCanBrowseTheWeb() { var joe = cast.Get <Joe>(); if (joe.HasAbility <BrowseTheWeb>()) { return; } joe.IsAbleTo(browseTheWeb); }
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); }
public void GivenAprilCanActAsTheApplication() { var april = cast.Get <April>(); if (april.HasAbility <ConsumeWebServices>()) { return; } april.IsAbleTo(actAsTheApplication); }
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); }
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>()); }
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"); }
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")); }
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)); }
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")); }
public void GivenSarahIsAnActorFromAPersona() { var sarah = cast.Get <Sarah>(); stage.ShineTheSpotlightOn(sarah); }
public static IActor GetMathsWhiz(this ICast cast, string name) { return(cast.Get(name, CustomiseActor)); }
public void GivenJoeIsAnActorInTheSpotlight() { var joe = cast.Get("Joe"); stage.ShineTheSpotlightOn(joe); }