Skip to content

Instantly share code, notes, and snippets.

@tswann
Created May 23, 2011 19:41
Show Gist options
  • Save tswann/987414 to your computer and use it in GitHub Desktop.
Save tswann/987414 to your computer and use it in GitHub Desktop.
StoryQ test sample
using NUnit.Framework;
using Should.Fluent;
using StoryQ;
namespace CodeSlice.UnitTesting.StoryQ
{
[TestFixture]
public class Tag
{
Model.Tag _tag;
[TestCase]
public void TagNameNormalisationTest()
{
new Story("Normalise Tag Name")
.InOrderTo("Create a tag")
.AsA("User")
.IWant("my tag to have a normalised name")
.WithScenario("Create new Tag")
.Given(IHaveCreatedANewTag)
.When(ISetItsNameTo, "New Test Tag")
.Then(ItShouldHaveTheNormalisedName, "newtesttag")
.ExecuteWithReport();
}
public void IHaveCreatedANewTag()
{
_tag = new Model.Tag();
}
public void ISetItsNameTo(string tagName)
{
_tag.Name = tagName;
}
public void ItShouldHaveTheNormalisedName(string normalisedName)
{
_tag.NormalisedName.Should().Equal(normalisedName);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment