[tinybdd] r72 committed - [No log message]

0 views
Skip to first unread message

codesite...@google.com

unread,
Nov 3, 2009, 6:35:21 PM11/3/09
to tin...@googlegroups.com
Revision: 72
Author: goeran.hansen
Date: Tue Nov 3 15:34:57 2009
Log: [No log message]
http://code.google.com/p/tinybdd/source/detail?r=72

Modified:
/trunk/TinyBDD/Dsl/GivenWhenThen/ScenarioClass.cs
/trunk/TinyBDD/Dsl/GivenWhenThen/Semantics.cs
/trunk/TinyBDDTests/Dsl/GivenWhenThen/ScenarioClassDslTests.cs

=======================================
--- /trunk/TinyBDD/Dsl/GivenWhenThen/ScenarioClass.cs Tue Nov 3 15:00:33
2009
+++ /trunk/TinyBDD/Dsl/GivenWhenThen/ScenarioClass.cs Tue Nov 3 15:34:57
2009
@@ -126,9 +126,14 @@

public void StartScenario()
{
+ SemanticModelState(semanticModelState);
specGenerator.Generate(semanticModelState);
Console.WriteLine(specGenerator.Output);
semanticModel.Execute();
}
+
+ protected virtual void SemanticModelState(AAAMemento
semanticModelState)
+ {
+ }
}
}
=======================================
--- /trunk/TinyBDD/Dsl/GivenWhenThen/Semantics.cs Tue Nov 3 15:22:32 2009
+++ /trunk/TinyBDD/Dsl/GivenWhenThen/Semantics.cs Tue Nov 3 15:34:57 2009
@@ -74,6 +74,8 @@
{
var st = new StackTrace();
var name = st.GetFrames().Skip(2).First().GetMethod().Name;
+ if (name == "Then")
+ name = st.GetFrames().Skip(3).First().GetMethod().Name;
return metadataParser.FormatText(name);
}

=======================================
--- /trunk/TinyBDDTests/Dsl/GivenWhenThen/ScenarioClassDslTests.cs Tue Nov
3 15:00:33 2009
+++ /trunk/TinyBDDTests/Dsl/GivenWhenThen/ScenarioClassDslTests.cs Tue Nov
3 15:34:57 2009
@@ -4,19 +4,22 @@
using System.Text;
using TinyBDD.Dsl.GivenWhenThen;
using NUnit.Framework;
+using TinyBDD.SemanticModel;
+using TinyBDD.Specification.NUnit;

namespace TinyBDDTests.Dsl.GivenWhenThen.ScenarioClassDslTests
{
public class Shared : ScenarioClass
{
+ protected AAAMemento semanticModelState;
+
protected Context there_are_changesets_in_sourceControl = () => {
};
protected When Controller_notified_to_refresh = () => { };
protected Then assure_all_changesets_are_received = () => { };

- [TearDown]
- public void Haldis()
- {
- StartScenario();
+ protected override void SemanticModelState(AAAMemento
semanticModelState)
+ {
+ this.semanticModelState = semanticModelState;
}
}

@@ -42,6 +45,33 @@
//Run();
}
}
+
+ [TestFixture]
+ public class When_describing_Scenario_using_test_methods_for_Thens :
Shared
+ {
+ [SetUp]
+ public void Setup()
+ {
+ Given(there_are_changesets_in_sourceControl).
+ And("Controller has been created");
+
+ When(Controller_notified_to_refresh);
+ }
+
+ [Test]
+ public void Assure_repository_is_contacted()
+ {
+ Then(() => { });
+ StartScenario();
+
+ //Asserts that the scenario is built as expected
+ semanticModelState.Text.ShouldBe("When describing Scenario
using test methods for Thens");
+ semanticModelState.Arranges[0].Text.ShouldBe("there are
changesets in sourceControl");
+ semanticModelState.Arranges[1].Text.ShouldBe("Controller has
been created");
+ semanticModelState.Acts.First().Key.Text.ShouldBe("Controller
notified to refresh");
+
semanticModelState.Acts.First().Value.First().Text.ShouldBe("Assure
repository is contacted");
+ }
+ }

[TestFixture]
public class When_describing_empty_Scenario : Shared

Reply all
Reply to author
Forward
0 new messages