Skip to content

Instantly share code, notes, and snippets.

@ashmoran
Created May 20, 2011 20:17
Show Gist options
  • Save ashmoran/983711 to your computer and use it in GitHub Desktop.
Save ashmoran/983711 to your computer and use it in GitHub Desktop.
MSpec nesting
/* What should the Resharper output of the current UI look like?
In my version (0.4.13) the following is shown:
EnumerableExtensions, and both enumerables contain the same items
should indicate that the enumerables are equal
I would have expected it to show something like:
EnumerableExtensions, when comparing two enumerables for item equality and both enumerables contain the same items
should indicate that the enumerables are equal
Is this a wrong asumption or what is the reasoning behind this? Is the runner not up to par with the nested context feature?
*/
[Subject(typeof (EnumerableExtensions))]
public class When_comparing_two_enumerables_for_item_equality
{
static IEnumerable<string> _LeftEnumerable;
static IEnumerable<string> _RightEnumerable;
static bool _AreEqual;
Because of = () => _AreEqual = _LeftEnumerable.ItemsEquals(_RightEnumerable);
public class and_both_enumerables_contain_the_the_same_items
{
Establish context = () =>
{
_LeftEnumerable = new[]
{
"a", "b", "c"
};
_RightEnumerable = new[]
{
"a", "b", "c"
};
};
It should_indicate_that_the_items_are_equal = () => _AreEqual.ShouldBeTrue();
}
public class and_the_enumerables_contain_the_different_items
{
Establish context = () =>
{
_LeftEnumerable = new[]
{
"a", "b", "c"
};
_RightEnumerable = new[]
{
"x", "y", "z"
};
};
It should_indicate_that_the_items_are_not_equal = () => _AreEqual.ShouldBeFalse();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment