Skip to content

Commit

Permalink
Improve test coverage by implementing positive scenario for convertin…
Browse files Browse the repository at this point in the history
…g data in MemberAutoDataBaseAttribute (#155)
  • Loading branch information
piotrzajac authored Oct 4, 2024
1 parent 879d73d commit 02dbb5a
Showing 1 changed file with 17 additions and 2 deletions.
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

0 comments on commit 02dbb5a

Please sign in to comment.