Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test coverage for convert in MemberAutoDataBaseAttribute #155

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void GivenUninitializedFixture_WhenConstructorIsInvoked_ThenExceptionIsTh
}

[MemberData(nameof(MemberTypeTestData))]
[Theory(DisplayName = "GIVEN item of unexpected type WHEN Convert is invoked THEN exception is thrown")]
public void GivenItemOfUnexpectedType_WhenConvertIsInvoked_ThenExceptionIsThrown(
[Theory(DisplayName = "GIVEN item of unexpected type WHEN ConvertDataItem is invoked THEN exception is thrown")]
public void GivenItemOfUnexpectedType_WhenConvertDataItemIsInvoked_ThenExceptionIsThrown(
Type memberType,
string expectedTypeName)
{
Expand All @@ -67,6 +67,21 @@ public void GivenItemOfUnexpectedType_WhenConvertIsInvoked_ThenExceptionIsThrown
.And.Contain(memberName).And.Contain(expectedTypeName);
}

[Fact(DisplayName = "GIVEN array WHEN ConvertDataItem is invoked THEN the same array is returned")]
public void GivenArray_WhenConvertDataItemIsInvoked_ThenTheSameArrayIsReturned()
{
// Arrange
var fixture = new Fixture();
var array = fixture.Create<object[]>();
var attribute = new MemberAutoDataBaseAttributeUnderTest(fixture, nameof(NullTheoryData));

// Act
var data = attribute.CallConvertDataItem(TestMethod, array);

// Assert
data.Should().BeEquivalentTo(array);
}

[Fact(DisplayName = "GIVEN null theory data WHEN GetData is invoked THEN null is returned")]
public void GivenNullItem_WhenGetDataIsInvoked_ThenNullIsReturned()
{
Expand Down
Loading