Skip to content

Instantly share code, notes, and snippets.

@amirrajan
Last active March 20, 2017 20:32
Show Gist options
  • Save amirrajan/573054053513fd7fbfe5430127212c9b to your computer and use it in GitHub Desktop.
Save amirrajan/573054053513fd7fbfe5430127212c9b to your computer and use it in GitHub Desktop.
NSpec Hello World
using NSpec;
using FluentAssertions;
class my_first_spec : nspec
{
string name;
void before_each()
{
name = "NSpec";
}
void it_asserts_at_the_method_level()
{
name.ShouldBeEquivalentTo("NSpec");
}
void describe_nesting()
{
before = () => name += " Add Some Other Stuff";
it["asserts in a method"] = () =>
{
name.ShouldBeEquivalentTo("NSpec Add Some Other Stuff");
};
context["more nesting"] = () =>
{
before = () => name += ", And Even More";
it["also asserts in a lambda"] = () =>
{
name.ShouldBeEquivalentTo("NSpec Add Some Other Stuff, And Even More");
};
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment