public Scenario(string title, string source) : this(title, source, new Feature()) { Feature = new Feature(); Title = title; _steps = new List<StringStep>(); _examples = new List<Example>(); }
public Scenario(string title, string source, Feature feature, int sourceLine) { Feature = feature; Title = title; Source = source; SourceLine = sourceLine; _steps = new List<StringStep>(); _examples = new List<Example>(); }
public IEnumerable<ClassificationSpan> CreateScenarioClassification(Feature feature, ITextSnapshot snapshot) { return feature.Scenarios .Select(scenario => { var snapshotSpan = CreateClassification(scenario.SourceLine, scenario.Title, snapshot); return (snapshotSpan.HasValue) ? new ClassificationSpan(snapshotSpan.Value, ClassificationRegistry.ScenarioTitle) : null; }) .Where(c => c != null); }
// public void SetupFeature( // NBehave.Narrator.Framework.Feature feature) // { // base.Feature = feature; // } protected override NBehave.Narrator.Framework.Feature CreateFeature() { NBehave.Narrator.Framework.Feature featureTest = new NBehave.Narrator.Framework.Feature(this.featureName) .AddStory() .AsA(this.asA) .IWant(this.iWant) .SoThat(this.soThat); return(featureTest); }
// public void SetupFeature( // NBehave.Narrator.Framework.Feature feature) // { // base.Feature = feature; // } protected override NBehave.Narrator.Framework.Feature CreateFeature() { NBehave.Narrator.Framework.Feature featureTest = new NBehave.Narrator.Framework.Feature(this.featureName) .AddStory() .AsA(this.asA) .IWant(this.iWant) .SoThat(this.soThat); return featureTest; }
public void RunScenario() { HelperClass.GivenWasCalled = false; var feature = new Feature("Hello"); feature.AddScenario() .WithHelperObject<HelperClass>() .Given("something to call") .And("something else") .When("method should be called") .Then("this should work"); }
public void ShouldRetrieveProducts() { var context = new RequestContext(); var story = new Feature("Should retrieve products"); story.AddScenario("Should retrieve all public and Company's products when User works for Company") .Given("User works for Company 1", () => context.UserWorksForCompany(1)) .And("$productName belongs to Company $companyId", () => context.ProductBelongsToCompany("Product 1", 1)) .And("$productName belongs to Company $companyId", () => context.ProductBelongsToCompany("Product 2", 2)) .And("$productName is public", () => context.ProductIsPublic("Product 3")) .When("retrieve products for User", context.RetrieveProductsForUser) .Then("retrieved products are: $productNames", () => context.RetrievedProductsAre(Strings.Create("Product 1", "Product 3"))); story.AddScenario("Should retrieve only public products when User does not work for any Company") .Given("user does not work for any company", context.UserDoesNotWorkForAnyCompany) .And("$productName belongs to company $companyId", () => context.ProductBelongsToCompany("Product 1", 1)) .And("$productName belongs to company $companyId", () => context.ProductBelongsToCompany("Product 2", 2)) .And("$productName is public", () => context.ProductIsPublic("Product 3")) .When("retrieve products for User", context.RetrieveProductsForUser) .Then("retrieved products are: $productNames", () => context.RetrievedProductsAre(Strings.Create("Product 3"))); }
public FeatureGherkinText(Feature feature) { this.feature = feature; }
public virtual void FeatureStarted(Feature feature) { }
public void Should_use_And_for_second_Given() { var feature = new Feature("Hello"); var scenarioBuilder = feature.AddScenario(); var fragment = scenarioBuilder.Given("foo"); fragment.And("bar"); var scenario = feature.Scenarios[0].ToString(); Assert.AreEqual( "Scenario: " + Environment.NewLine + " Given foo" + Environment.NewLine + " And bar", scenario); }
private IList<ClassificationSpan> SelectClassifiable(Feature feature, ITextSnapshot snapshot) { ClassificationSpan f = GherkinClassifier.CreateFeatureClassification(feature, snapshot); var classificationSpans = new List<ClassificationSpan>(); //classificationSpans.Add(f); classificationSpans.AddRange(GherkinClassifier.CreateScenarioClassification(feature, snapshot).ToList()); return classificationSpans; }
public StoryBuilder(Feature feature) { _feature = feature; }
public ClassificationSpan CreateFeatureClassification(Feature feature, ITextSnapshot snapshot) { var snapshotSpan = CreateClassification(feature.SourceLine, feature.Title, snapshot); return (snapshotSpan.HasValue) ? new ClassificationSpan(snapshotSpan.Value, ClassificationRegistry.FeatureTitle) : null; }
public void RunScenario() { var feature = new Feature("Hello"); feature.AddScenario() .WithHelperObject(this) .Given("something to call") .And("something else") .When("method should be called") .Then("this should work"); }
public void Should_use_And_for_second_Then() { var feature = new Feature("Hello"); var scenarioBuilder = feature.AddScenario(); var fragment = scenarioBuilder.Given("foo"); var whenFragment = fragment.When("bar"); var thenFragment = whenFragment.Then("moo"); thenFragment.And("moo-moo"); var scenario = feature.Scenarios[0].ToString(); Assert.AreEqual( "Scenario: " + Environment.NewLine + " Given foo" + Environment.NewLine + " When bar" + Environment.NewLine + " Then moo" + Environment.NewLine + " And moo-moo", scenario); }
public FeatureContext(Feature feature) { Feature = feature; }
public FeatureContext(Feature feature, IEnumerable<string> tags) : this(feature) { AddTags(tags); }
private void CreateFeatureElement(Feature feature) { IProjectFile featureFile = FindFile(feature); _parent = new NBehaveFeatureTestElement(feature.Title, featureFile, _unitTestProvider, _projectModel); Add(_parent); }
public Scenario(string title, string source, Feature feature) : this(title, source, feature, -1) { }
private IProjectFile FindFile(Feature feature) { ICollection<IProjectItem> proj = _solution.FindProjectItemsByLocation(new FileSystemPath(feature.Source)); string featureFileName = Path.GetFileName(feature.Source.ToLower()); foreach (var item in proj) { var project = item.GetProject(); var file = project.GetAllProjectFiles().SingleOrDefault(_ => Path.GetFileName(_.Location.FullPath.ToLower()) == featureFileName); if (file != null) return file; } return null; }
public override void FeatureStarted(Feature feature) { listener.WriteLine("\tFeature: " + feature.Title, Category.Output); }
private void BuildScenarios(Feature feature) { foreach (var scenario in feature.Scenarios) { BuildScenario(scenario); } }
public AsAFragment(Feature feature) { _builder = new StoryBuilder(feature); }
public ScenarioResult(Feature feature, string scenarioTitle) { FeatureTitle = feature.Title; ScenarioTitle = scenarioTitle; _actionStepResults = new List<StepResult>(); }
public ScenarioExampleResult(Feature feature, string scenarioTitle, IEnumerable<StringStep> stringSteps, IEnumerable<Example> examples) : base(feature, scenarioTitle) { AddSteps(stringSteps); Examples = examples; }
public void Should_call_method_with_attribute_in_ActionStepsClass() { bool givenWasCalled = false; bool andWasCalled = false; bool whenWasCalled = false; bool thenWasCalled = false; var feature = new Feature("Hello"); feature.AddScenario() .Given("something to call", () => givenWasCalled = true) .And("something else", () => andWasCalled = true) .When("method should be called", () => whenWasCalled = true) .Then("this should work", () => thenWasCalled = true); Assert.IsTrue(givenWasCalled, "Given step was not invoked"); Assert.IsTrue(andWasCalled, "And step was not invoked"); Assert.IsTrue(whenWasCalled, "When step was not invoked"); Assert.IsTrue(thenWasCalled, "Then step was not invoked"); }