diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/AutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/AutoMockDataAttributeTests.cs index b91d32aa..d536db9c 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/AutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/AutoMockDataAttributeTests.cs @@ -1,6 +1,5 @@ namespace Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests.Attributes { - using System; using System.Collections.Generic; using System.Reflection; @@ -80,16 +79,24 @@ public void WhenGetDataIsInvoked_ThenFixtureIsConfiguredAndDataReturned(bool ign } [AutoMockData] - [Theory(DisplayName = "GIVEN test method has some parameters WHEN test run THEN parameters are generated")] - public void GivenTestMethodHasSomeParameters_WhenTestRun_ThenParametersAreGenerated(int value, IDisposable disposable) + [Theory(DisplayName = "GIVEN test method has some value parameters WHEN test run THEN parameters are generated")] + public void GivenTestMethodHasSomeValueParameters_WhenTestRun_ThenParametersAreGenerated(int value) { // Arrange // Act // Assert value.Should().NotBe(default); + } - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().Contain("Proxy", "that way we know it was mocked."); + [AutoMockData] + [Theory(DisplayName = "GIVEN test method has some object parameters WHEN test run THEN parameters are generated")] + public void GivenTestMethodHasSomeObjectParameters_WhenTestRun_ThenParametersAreGenerated(IFakeObjectUnderTest value) + { + // Arrange + // Act + // Assert + value.Should().NotBeNull(); + value.StringProperty.Should().NotBeNullOrEmpty(); } protected void MethodUnderTest() diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/InlineAutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/InlineAutoMockDataAttributeTests.cs index 78d2132f..03f96acb 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/InlineAutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/InlineAutoMockDataAttributeTests.cs @@ -1,6 +1,5 @@ namespace Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests.Attributes { - using System; using System.Collections.Generic; using System.Reflection; @@ -114,15 +113,19 @@ public void WhenGetDataIsInvoked_ThenFixtureIsConfiguredAndDataReturned(bool ign [InlineAutoMockData(100)] [Theory(DisplayName = "GIVEN test method has some inline parameters WHEN test run THEN parameters are generated")] - public void GivenTestMethodHasSomeInlineParameters_WhenTestRun_ThenParametersAreGenerated(int value, IDisposable disposable) + public void GivenTestMethodHasSomeInlineParameters_WhenTestRun_ThenParametersAreGenerated( + int firstValueInstance, + int secondValueInstance, + IFakeObjectUnderTest objectInstance) { // Arrange // Act // Assert - value.Should().Be(100); + firstValueInstance.Should().Be(100); + secondValueInstance.Should().NotBe(default); - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().Contain("Proxy", "that way we know it was mocked."); + objectInstance.Should().NotBeNull(); + objectInstance.StringProperty.Should().NotBeNullOrEmpty(); } protected void MethodUnderTest() diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/MemberAutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/MemberAutoMockDataAttributeTests.cs index d06a7d8a..c5414ffa 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/MemberAutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/Attributes/MemberAutoMockDataAttributeTests.cs @@ -164,7 +164,12 @@ public void GivenUninitializedMemberName_WhenConstructorIsInvoked_ThenExceptionI [Theory(DisplayName = "GIVEN test method has some member generated parameters WHEN test run THEN parameters are provided")] [MemberAutoMockData(nameof(TestData))] - public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenParametersAreProvided(int first, int second, int third, int fourth, IDisposable disposable) + public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenParametersAreProvided( + int first, + int second, + int third, + int fourth, + IFakeObjectUnderTest objectInstance) { // Arrange var testData = TestData.ToList(); @@ -176,8 +181,8 @@ public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenPara third.Should().BeOneOf((int)testData[0][2], (int)testData[1][2], (int)testData[2][2]); fourth.Should().NotBe(default); - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().Contain("Proxy", "that way we know it was mocked."); + objectInstance.Should().NotBeNull(); + objectInstance.StringProperty.Should().NotBeNullOrEmpty(); } } } diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/IFakeObjectUnderTest.cs b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/IFakeObjectUnderTest.cs new file mode 100644 index 00000000..bd778081 --- /dev/null +++ b/src/Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests/IFakeObjectUnderTest.cs @@ -0,0 +1,7 @@ +namespace Objectivity.AutoFixture.XUnit2.AutoFakeItEasy.Tests +{ + public interface IFakeObjectUnderTest + { + public string StringProperty { get; set; } + } +} diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/AutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/AutoMockDataAttributeTests.cs index f430187b..968b3746 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/AutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/AutoMockDataAttributeTests.cs @@ -1,6 +1,5 @@ namespace Objectivity.AutoFixture.XUnit2.AutoMoq.Tests.Attributes { - using System; using System.Collections.Generic; using System.Reflection; @@ -80,16 +79,24 @@ public void WhenGetDataIsInvoked_ThenFixtureIsConfiguredAndDataReturned(bool ign } [AutoMockData] - [Theory(DisplayName = "GIVEN test method has some parameters WHEN test run THEN parameters are generated")] - public void GivenTestMethodHasSomeParameters_WhenTestRun_ThenParametersAreGenerated(int value, IDisposable disposable) + [Theory(DisplayName = "GIVEN test method has some value parameters WHEN test run THEN parameters are generated")] + public void GivenTestMethodHasSomeValueParameters_WhenTestRun_ThenParametersAreGenerated(int value) { // Arrange // Act // Assert value.Should().NotBe(default); + } - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().StartWith("IDisposableProxy", "that way we know it was mocked."); + [AutoMockData] + [Theory(DisplayName = "GIVEN test method has some object parameters WHEN test run THEN parameters are generated")] + public void GivenTestMethodHasSomeObjectParameters_WhenTestRun_ThenParametersAreGenerated(IFakeObjectUnderTest value) + { + // Arrange + // Act + // Assert + value.Should().NotBeNull(); + value.StringProperty.Should().NotBeNullOrEmpty(); } protected void MethodUnderTest() diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/InlineAutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/InlineAutoMockDataAttributeTests.cs index d5bfc249..0b690c6c 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/InlineAutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/InlineAutoMockDataAttributeTests.cs @@ -1,6 +1,5 @@ namespace Objectivity.AutoFixture.XUnit2.AutoMoq.Tests.Attributes { - using System; using System.Collections.Generic; using System.Reflection; @@ -114,15 +113,19 @@ public void WhenGetDataIsInvoked_ThenFixtureIsConfiguredAndDataReturned(bool ign [InlineAutoMockData(100)] [Theory(DisplayName = "GIVEN test method has some inline parameters WHEN test run THEN parameters are generated")] - public void GivenTestMethodHasSomeInlineParameters_WhenTestRun_ThenParametersAreGenerated(int value, IDisposable disposable) + public void GivenTestMethodHasSomeInlineParameters_WhenTestRun_ThenParametersAreGenerated( + int firstValueInstance, + int secondValueInstance, + IFakeObjectUnderTest objectInstance) { // Arrange // Act // Assert - value.Should().Be(100); + firstValueInstance.Should().Be(100); + secondValueInstance.Should().NotBe(default); - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().StartWith("IDisposableProxy", "that way we know it was mocked."); + objectInstance.Should().NotBeNull(); + objectInstance.StringProperty.Should().NotBeNullOrEmpty(); } protected void MethodUnderTest() diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/MemberAutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/MemberAutoMockDataAttributeTests.cs index bb444740..96084437 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/MemberAutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/Attributes/MemberAutoMockDataAttributeTests.cs @@ -164,7 +164,12 @@ public void GivenUninitializedMemberName_WhenConstructorIsInvoked_ThenExceptionI [Theory(DisplayName = "GIVEN test method has some member generated parameters WHEN test run THEN parameters are provided")] [MemberAutoMockData(nameof(TestData))] - public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenParametersAreProvided(int first, int second, int third, int fourth, IDisposable disposable) + public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenParametersAreProvided( + int first, + int second, + int third, + int fourth, + IFakeObjectUnderTest objectInstance) { // Arrange var testData = TestData.ToList(); @@ -176,8 +181,8 @@ public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenPara third.Should().BeOneOf((int)testData[0][2], (int)testData[1][2], (int)testData[2][2]); fourth.Should().NotBe(default); - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().StartWith("IDisposableProxy", "that way we know it was mocked."); + objectInstance.Should().NotBeNull(); + objectInstance.StringProperty.Should().NotBeNullOrEmpty(); } } } diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/IFakeObjectUnderTest.cs b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/IFakeObjectUnderTest.cs new file mode 100644 index 00000000..ecada34d --- /dev/null +++ b/src/Objectivity.AutoFixture.XUnit2.AutoMoq.Tests/IFakeObjectUnderTest.cs @@ -0,0 +1,7 @@ +namespace Objectivity.AutoFixture.XUnit2.AutoMoq.Tests +{ + public interface IFakeObjectUnderTest + { + public string StringProperty { get; set; } + } +} diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/AutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/AutoMockDataAttributeTests.cs index a4bed765..1112f003 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/AutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/AutoMockDataAttributeTests.cs @@ -1,6 +1,5 @@ namespace Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests.Attributes { - using System; using System.Collections.Generic; using System.Reflection; @@ -79,16 +78,24 @@ public void WhenGetDataIsInvoked_ThenFixtureIsConfiguredAndDataReturned(bool ign } [AutoMockData] - [Theory(DisplayName = "GIVEN test method has some parameters WHEN test run THEN parameters are generated")] - public void GivenTestMethodHasSomeParameters_WhenTestRun_ThenParametersAreGenerated(int value, IDisposable disposable) + [Theory(DisplayName = "GIVEN test method has some value parameters WHEN test run THEN parameters are generated")] + public void GivenTestMethodHasSomeValueParameters_WhenTestRun_ThenParametersAreGenerated(int value) { // Arrange // Act // Assert value.Should().NotBe(default); + } - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().StartWith("ObjectProxy", "that way we know it was mocked."); + [AutoMockData] + [Theory(DisplayName = "GIVEN test method has some object parameters WHEN test run THEN parameters are generated")] + public void GivenTestMethodHasSomeObjectParameters_WhenTestRun_ThenParametersAreGenerated(IFakeObjectUnderTest value) + { + // Arrange + // Act + // Assert + value.Should().NotBeNull(); + value.StringProperty.Should().NotBeNullOrEmpty(); } protected void MethodUnderTest() diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/InlineAutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/InlineAutoMockDataAttributeTests.cs index 81c19dbc..c1dfac7d 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/InlineAutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/InlineAutoMockDataAttributeTests.cs @@ -1,6 +1,5 @@ namespace Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests.Attributes { - using System; using System.Collections.Generic; using System.Reflection; @@ -113,15 +112,19 @@ public void WhenGetDataIsInvoked_ThenFixtureIsConfiguredAndDataReturned(bool ign [InlineAutoMockData(100)] [Theory(DisplayName = "GIVEN test method has some inline parameters WHEN test run THEN parameters are generated")] - public void GivenTestMethodHasSomeInlineParameters_WhenTestRun_ThenParametersAreGenerated(int value, IDisposable disposable) + public void GivenTestMethodHasSomeInlineParameters_WhenTestRun_ThenParametersAreGenerated( + int firstValueInstance, + int secondValueInstance, + IFakeObjectUnderTest objectInstance) { // Arrange // Act // Assert - value.Should().Be(100); + firstValueInstance.Should().Be(100); + secondValueInstance.Should().NotBe(default); - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().StartWith("ObjectProxy", "that way we know it was mocked."); + objectInstance.Should().NotBeNull(); + objectInstance.StringProperty.Should().NotBeNullOrEmpty(); } protected void MethodUnderTest() diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/MemberAutoMockDataAttributeTests.cs b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/MemberAutoMockDataAttributeTests.cs index 942356d2..4b2a09da 100644 --- a/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/MemberAutoMockDataAttributeTests.cs +++ b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/Attributes/MemberAutoMockDataAttributeTests.cs @@ -163,7 +163,12 @@ public void GivenUninitializedMemberName_WhenConstructorIsInvoked_ThenExceptionI [Theory(DisplayName = "GIVEN test method has some member generated parameters WHEN test run THEN parameters are provided")] [MemberAutoMockData(nameof(TestData))] - public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenParametersAreProvided(int first, int second, int third, int fourth, IDisposable disposable) + public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenParametersAreProvided( + int first, + int second, + int third, + int fourth, + IFakeObjectUnderTest objectInstance) { // Arrange var testData = TestData.ToList(); @@ -175,8 +180,8 @@ public void GivenTestMethodHasSomeMemberGeneratedParameters_WhenTestRun_ThenPara third.Should().BeOneOf((int)testData[0][2], (int)testData[1][2], (int)testData[2][2]); fourth.Should().NotBe(default); - disposable.Should().NotBeNull(); - disposable.GetType().Name.Should().StartWith("ObjectProxy", "that way we know it was mocked."); + objectInstance.Should().NotBeNull(); + objectInstance.StringProperty.Should().NotBeNullOrEmpty(); } } } diff --git a/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/IFakeObjectUnderTest.cs b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/IFakeObjectUnderTest.cs new file mode 100644 index 00000000..6189c5e1 --- /dev/null +++ b/src/Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests/IFakeObjectUnderTest.cs @@ -0,0 +1,7 @@ +namespace Objectivity.AutoFixture.XUnit2.AutoNSubstitute.Tests +{ + public interface IFakeObjectUnderTest + { + public string StringProperty { get; set; } + } +}