[tinybdd] r73 committed - Impl smarter handling of clearing old scenario when starting to descri...

0 views
Skip to first unread message

codesite...@google.com

unread,
Nov 3, 2009, 7:03:33 PM11/3/09
to tin...@googlegroups.com
Revision: 73
Author: goeran.hansen
Date: Tue Nov 3 16:02:45 2009
Log: Impl smarter handling of clearing old scenario when starting to
describing a new one
http://code.google.com/p/tinybdd/source/detail?r=73

Modified:
/trunk/TinyBDD/Dsl/GivenWhenThen/ScenarioClass.cs

=======================================
--- /trunk/TinyBDD/Dsl/GivenWhenThen/ScenarioClass.cs Tue Nov 3 15:34:57
2009
+++ /trunk/TinyBDD/Dsl/GivenWhenThen/ScenarioClass.cs Tue Nov 3 16:02:45
2009
@@ -13,6 +13,7 @@
private Semantics scenario;
private TextSpecGenerator specGenerator;
private TestMetadataParser metadataParser;
+ private bool flagClearScenario;

public ScenarioClass() :
this(new AAAMemento())
@@ -33,27 +34,42 @@
public void Scenario(string text)
{
semanticModelState.Text = text;
- semanticModelState.Arranges.Clear();
- semanticModelState.Acts.Clear();
+
+ flagClearScenario = true;
+ ClearScenario();
+ }
+
+ private void ClearScenario()
+ {
+ if (flagClearScenario)
+ {
+ semanticModelState.Arranges.Clear();
+ semanticModelState.Acts.Clear();
+ flagClearScenario = false;
+ }
}

public GivenSemantics Given(string text)
{
+ ClearScenario();
return scenario.Given(text);
}

public GivenSemantics Given(string text, Action action)
{
+ ClearScenario();
return scenario.Given(text, action);
}

public GivenSemantics Given(Context context)
{
+ ClearScenario();
return scenario.Given(context);
}

public GivenSemantics Given(GivenSemantics semantics)
{
+ ClearScenario();
return semantics;
}

@@ -130,6 +146,8 @@
specGenerator.Generate(semanticModelState);
Console.WriteLine(specGenerator.Output);
semanticModel.Execute();
+
+ flagClearScenario = true;
}

protected virtual void SemanticModelState(AAAMemento
semanticModelState)

Reply all
Reply to author
Forward
0 new messages