public void ShouldRunStory() { //Given FakeStory story = new FakeStory(); StoryRunner storyRunner = new StoryRunner(); storyRunner.AddStory(story); //When storyRunner.Run(); //Then Assert.IsTrue(story.didCallRun); }
public void ShouldAddScenarioToStory() { //Given Mockery mocks = new Mockery(); IScenario scenario = mocks.NewMock<IScenario>(); IStory story = new FakeStory(); //When story.AddScenario(scenario); //Then Assert.AreEqual(1, story.ScenarioItems.Count); }
public void ShouldAddScenarioToStory() { //Given Mockery mocks = new Mockery(); IScenario scenario = mocks.NewMock <IScenario>(); IStory story = new FakeStory(); //When story.AddScenario(scenario); //Then Assert.AreEqual(1, story.ScenarioItems.Count); }
public void StoryShouldHaveNarrative() { //Given Story.Story theStory = new FakeStory(); const string user = "******"; const string feature = "this to work"; const string benefit = "I can move to the next feature"; string outcome = string.Format("As a {1}{0}I want {2}{0}So that {3}", Environment.NewLine, user, feature, benefit); //When ((INarrativeAsA)theStory).AsA(user).IWant(feature).SoThat(benefit); //Then Assert.AreEqual(outcome, theStory.Narrative.ToString()); }
public void ShouldRunStoryAndGetStuffInStream() { //Given string expectToHave = "Passed: 1"; FakeStory story = new FakeStory(); Stream sr = new MemoryStream(); StreamRunner storyRunner = new StreamRunner(sr, System.Reflection.Assembly.GetAssembly(this.GetType())); //When storyRunner.Run(); //Then sr.Seek(0, 0); TextReader s = new StreamReader(sr); string result = s.ReadToEnd(); Assert.IsTrue(result.Contains(expectToHave)); }
public void ShouldRunStorySuccessfully() { //Given Mockery mocks = new Mockery(); SimplestPossibleWorld world = new SimplestPossibleWorld(); IStory story = new FakeStory(); //Story has scenarios IScenario scenario = mocks.NewMock<IScenario>(); story.AddScenario(scenario); Expect.Once.On(scenario).Method("Run").Will(Return.Value(new Outcome(OutcomeResult.Passed, "yadda yadda"))); //When story.Run(); //Then mocks.VerifyAllExpectationsHaveBeenMet(); }
public void ShouldRunStorySuccessfully() { //Given Mockery mocks = new Mockery(); SimplestPossibleWorld world = new SimplestPossibleWorld(); IStory story = new FakeStory(); //Story has scenarios IScenario scenario = mocks.NewMock <IScenario>(); story.AddScenario(scenario); Expect.Once.On(scenario).Method("Run").Will(Return.Value(new Outcome(OutcomeResult.Passed, "yadda yadda"))); //When story.Run(); //Then mocks.VerifyAllExpectationsHaveBeenMet(); }
public void ShouldRunStoryAndGetStuffInStream() { //Given string expectToStartWith = "Story: Fake story"; string expectToContain = "--> Passed" + Environment.NewLine; FakeStory story = new FakeStory(); System.Collections.ArrayList stories = new System.Collections.ArrayList(); stories.Add(story); Stream sr = new MemoryStream(); StreamRunner storyRunner = new FullTextRunner(sr, System.Reflection.Assembly.GetAssembly(this.GetType())); //When storyRunner.Run(); //Then sr.Seek(0, 0); TextReader s = new StreamReader(sr); string result = s.ReadToEnd(); Assert.IsTrue(result.StartsWith(expectToStartWith)); Assert.IsTrue(result.Contains(expectToContain)); }