Skip to content

Instantly share code, notes, and snippets.

@adamralph
Last active December 12, 2015 08:48
Show Gist options
  • Save adamralph/4746267 to your computer and use it in GitHub Desktop.
Save adamralph/4746267 to your computer and use it in GitHub Desktop.
I <3 xBehave.net! for more info see https://github.com/xbehave/xbehave.net
[Scenario]
[Example(typeof(int), 0)]
[Example(typeof(object), null)]
public static void GeneratedDefaultValue<TValue>
(Type type, TValue expectedValue, Argument argument)
{
"Given the type {0}"
.Given(() => { });
"When constructing an argument using the type"
.When(() => argument = new Argument(type));
"Then the argument should be a generated default"
.Then(() => argument.IsGeneratedDefault.Should().BeTrue());
"And the argument value should be {1}"
.And(() => argument.Value.Should().Be(expectedValue));
}
// output (this is still a work in progress):
// Scenario: GeneratedDefaultValue for System.Int32
// Given the type System.Int32
// When constructing an argument using the type
// Then the argument should be a generated default
// And the argument value should be 0
// Scenario: GeneratedDefaultValue for System.Object
// Given the type System.Object
// When constructing an argument using the type
// Then the argument should be a generated default
// And the argument value should be null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment