Skip to content

Commit

Permalink
and some more refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mattflo committed May 13, 2011
1 parent 9b0ae51 commit 6d97bab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
13 changes: 5 additions & 8 deletions NSpec/Domain/Example.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public static string Parse(Expression<Action> exp)

public void Run()
{
WasExecuted = true;

if (MethodLevelExample != null)
{
try
Expand Down Expand Up @@ -63,12 +61,11 @@ public Example(MethodInfo methodLevelExample)
MethodLevelExample = methodLevelExample;
}

public bool Pending { get; set; }
public string Spec { get; set; }
public Exception Exception { get; set; }
public Context Context { get; set; }
public MethodInfo MethodLevelExample { get; set; }
public bool WasExecuted { get; private set; }
public bool Pending;
public string Spec;
public Exception Exception;
public Context Context;
public MethodInfo MethodLevelExample;

Action action;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq;
using NUnit.Framework;
using NSpec;
using NSpec.Domain;
Expand All @@ -15,13 +12,17 @@ public class describe_method_level_examples
{
class SpecClass : nspec
{
public static bool first_example_executed, last_example_executed;

void it_should_be_an_example()
{
first_example_executed = true;
"hello".should_be("hello");
}

void it_should_be_failing()
{
last_example_executed = true;
"hello".should_not_be("hello");
}
}
Expand All @@ -47,15 +48,15 @@ public void the_class_context_should_contain_a_class_level_example()
}

[Test]
public void the_first_example_should_have_been_executed()
public void should_execute_first_example()
{
classContext.Examples.First().WasExecuted.should_be_true();
SpecClass.first_example_executed.should_be_true();
}

[Test]
public void the_last_example_should_have_been_executed()
public void should_execute_last_example()
{
classContext.Examples.First().WasExecuted.should_be_true();
SpecClass.last_example_executed.should_be_true();
}

[Test]
Expand Down

0 comments on commit 6d97bab

Please sign in to comment.