Skip to content

Instantly share code, notes, and snippets.

@DavidSSL
Last active December 16, 2015 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidSSL/5411894 to your computer and use it in GitHub Desktop.
Save DavidSSL/5411894 to your computer and use it in GitHub Desktop.
Correct implementation of Parser Test
[Theory, AutoFixture]
public void ParseValidInputShouldReturnCorrectResult(
PatientReportParser sut)
{
const string argsString = @"-o=C:\Temp\someFile -p=1 -d";
var args = new string[0];
IResult actualResult = null;
var expectedResult =
new Likeness<CreateReportResult, CreateReportResult>(new CreateReportResult(@"C:\Temp\someFile", "1", "database"));
"Given valid arguments"
.Given(() => args = argsString.Split(' '));
"When Parse is called"
.When(() => actualResult = (CreateReportResult) sut.Parse(args));
"Then the correct IResult should be returned"
.Then(() => actualResult.Should().BeOfType<CreateReportResult>());
"And the CreateReportResult should be correctly initialised"
.And(() => Assert.True(expectedResult.Equals(actualResult), "The CreateReport object's properties should have been initialised correctly"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment