Skip to content

Commit

Permalink
No need for memberName in IDataItemExtender.Extend method (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrzajac authored Nov 11, 2024
1 parent 5de9125 commit bfc43a3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ public class MemberAutoDataItemExtenderTests
private readonly Mock<IAutoFixtureInlineAttributeProvider> dataAttributeProvider = new();
private readonly Mock<DataAttribute> dataAttribute = new();
private readonly IDataItemExtender converter;
private readonly string memberName;

public MemberAutoDataItemExtenderTests()
{
var data = this.fixture.Create<IEnumerable<object[]>>();
this.dataAttributeProvider.Setup(p => p.GetAttribute(this.fixture, It.IsAny<object[]>())).Returns(this.dataAttribute.Object);
this.dataAttribute.Setup(a => a.GetData(It.IsAny<MethodInfo>())).Returns(data);
this.converter = new MemberAutoDataItemExtender(this.fixture, this.dataAttributeProvider.Object);
this.memberName = this.fixture.Create<string>();
}

[Fact(DisplayName = "GIVEN provider with no data attribute WHEN Convert is invoked THEN Null is returned")]
Expand All @@ -50,7 +48,7 @@ public void GivenProviderWithNoDataAttribute_WhenConvertIsInvoked_ThenNullReturn
var item = this.fixture.Create<object[]>();

// Act
var data = noDataConverter.Extend(TestMethod, item, this.memberName);
var data = noDataConverter.Extend(TestMethod, item);

// Assert
data.Should().BeNull();
Expand All @@ -65,7 +63,7 @@ public void GivenValidParameters_WhenConvertIsInvoked_ThenAppropriateCodeIsInvok
var item = this.fixture.Create<object[]>();

// Act
var data = this.converter.Extend(TestMethod, item, this.memberName);
var data = this.converter.Extend(TestMethod, item);

// Assert
data.Should().NotBeNull();
Expand All @@ -80,7 +78,7 @@ public void GivenUninitializedItem_WhenConvertInvoked_ThenNullReturned()
const object[] item = null;

// Act
var data = this.converter.Extend(TestMethod, item, this.memberName);
var data = this.converter.Extend(TestMethod, item);

// Assert
data.Should().BeNull();
Expand All @@ -94,7 +92,7 @@ public void GivenUninitializedTestMethod_WhenConvertIsInvoked_ThenExceptionIsThr
var item = this.fixture.Create<object[]>();

// Act
Func<object> act = () => this.converter.Extend(method, item, this.memberName);
Func<object> act = () => this.converter.Extend(method, item);

// Assert
act.Should().Throw<ArgumentNullException>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private object[] ExtendDataItem(MethodInfo testMethod, object[] values)

var converter = new MemberAutoDataItemExtender(fixture, this.CreateProvider());

return converter.Extend(testMethod, values, this.MemberName);
return converter.Extend(testMethod, values);
}

private Type RetrieveMemberType(MethodInfo testMethod)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

public interface IDataItemExtender
{
object[] Extend(MethodInfo testMethod, object[] values, string memberName);
object[] Extend(MethodInfo testMethod, object[] values);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MemberAutoDataItemExtender(IFixture fixture, IAutoFixtureInlineAttributeP
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global", Justification = "Testable design.")]
public IAutoFixtureInlineAttributeProvider DataAttributeProvider { get; }

public object[] Extend(MethodInfo testMethod, object[] values, string memberName)
public object[] Extend(MethodInfo testMethod, object[] values)
{
if (values is null)
{
Expand Down

0 comments on commit bfc43a3

Please sign in to comment.