[tinybdd] r56 committed - Fixed a bug in the SemanticModel.

0 views
Skip to first unread message

codesite...@google.com

unread,
Sep 15, 2009, 4:50:20 AM9/15/09
to tin...@googlegroups.com
Revision: 56
Author: goeran.hansen
Date: Tue Sep 15 01:49:39 2009
Log: Fixed a bug in the SemanticModel.

http://code.google.com/p/tinybdd/source/detail?r=56

Modified:
/trunk/TinyBDD/SemanticModel/AAA.cs
/trunk/TinyBDD/SemanticModel/Act.cs

=======================================
--- /trunk/TinyBDD/SemanticModel/AAA.cs Tue Jun 23 15:58:04 2009
+++ /trunk/TinyBDD/SemanticModel/AAA.cs Tue Sep 15 01:49:39 2009
@@ -9,15 +9,12 @@
{
string text;
Arrange lastArrange;
- List<Arrange> arranges;
- List<Act> acts;
Act lastAct;
AAAMemento memento;

public AAA()
{
- arranges = new List<Arrange>();
- acts = new List<Act>();
+ this.memento = new AAAMemento();
}

public AAA(AAAMemento memento)
@@ -41,7 +38,6 @@
public void Arrange(string text, Action action)
{
lastArrange = new Arrange(text, action);
- arranges.Add(lastArrange);

RememberArrange();
}
@@ -55,7 +51,6 @@
public void Act(string text, Action action)
{
lastAct = NewAct(text, action);
- acts.Add(lastAct);

RememberActs();
}
@@ -84,11 +79,11 @@

public void Execute()
{
- acts.ForEach(a =>
- {
- arranges.ForEach(arrange => arrange.Execute());
- a.Execute();
- });
+ foreach (var act in memento.Acts)
+ {
+ memento.Arranges.ForEach(arrange => arrange.Execute());
+ act.Key.Execute();
+ }
}
}
}
=======================================
--- /trunk/TinyBDD/SemanticModel/Act.cs Tue May 26 10:06:40 2009
+++ /trunk/TinyBDD/SemanticModel/Act.cs Tue Sep 15 01:49:39 2009
@@ -8,14 +8,12 @@
public class Act : Base
{
private Assert lastAssert;
- private List<Assert> asserts;
private AAAMemento memento;

public Act(string text, Action action)
{
Text = text;
Action = action;
- asserts = new List<Assert>();
}

public Act(string text, Action action, AAAMemento memento)
@@ -27,20 +25,19 @@
public void Assert(string text, Action action)
{
lastAssert = new Assert(text, action);
- asserts.Add(lastAssert);
RememberAsserts();
}

private void RememberAsserts()
{
if (memento != null)
- memento.Acts[this].Add(this.lastAssert);
+ memento.Acts[this].Add(lastAssert);
}

public override void Execute()
{
base.Execute();
- asserts.ForEach(a => a.Execute());
+ memento.Acts[this].ForEach(a => a.Execute());
}
}
}

Reply all
Reply to author
Forward
0 new messages