Index: Core/Common/test/Core.Common.TestUtil/EqualsGuidelinesTestFixture.cs =================================================================== diff -u -rd3ce0693ae43ed2434ba16480ff1659fbe49f0a9 -r6485cbb788198f30338fceecf8f9101b1adced51 --- Core/Common/test/Core.Common.TestUtil/EqualsGuidelinesTestFixture.cs (.../EqualsGuidelinesTestFixture.cs) (revision d3ce0693ae43ed2434ba16480ff1659fbe49f0a9) +++ Core/Common/test/Core.Common.TestUtil/EqualsGuidelinesTestFixture.cs (.../EqualsGuidelinesTestFixture.cs) (revision 6485cbb788198f30338fceecf8f9101b1adced51) @@ -25,12 +25,10 @@ { /// /// Testfixture that asserts overrides of the function - /// which follows the guidelines specified at + /// of classes that cannot be derived (sealed) following the guidelines specified at /// https://msdn.microsoft.com/en-us/library/ms173147(v=vs.90).aspx /// /// The class to assert. - /// The directly derived class from - /// without any modifications. /// Derived classes must implement a static function named GetUnequalTestCases /// which returns object configurations that are different from the values in . /// @@ -41,11 +39,6 @@ /// { /// // Returns a base configuration /// } - /// - /// protected override TDerived CreateDerivedObject() - /// { - /// // Returns a derived object with the same properties and values as CreateObject() - /// } /// /// private static IEnumerable<TestCaseData> GetUnequalTestCases() /// { @@ -55,8 +48,7 @@ /// /// [TestFixture] - public abstract class EqualsGuidelinesTestFixture where T : class - where TDerived : T + public abstract class EqualsGuidelinesTestFixture where T : class { [Test] public void Equals_ToNull_ReturnsFalse() @@ -114,20 +106,6 @@ } [Test] - public void Equals_ToDerivedObject_ReturnsFalse() - { - // Setup - T item1 = CreateObject(); - TDerived deriveditem = CreateDerivedObject(); - - // Call - bool itemEqualToDerivedItem = item1.Equals(deriveditem); - - // Assert - Assert.IsFalse(itemEqualToDerivedItem); - } - - [Test] public void Equals_AllPropertiesEqual_ReturnsTrue() { // Setup @@ -202,10 +180,61 @@ /// /// A fully configured object of type protected abstract T CreateObject(); + } + /// + /// Testfixture that asserts overrides of the function + /// which follows the guidelines specified at + /// https://msdn.microsoft.com/en-us/library/ms173147(v=vs.90).aspx + /// + /// The class to assert. + /// The directly derived class from + /// without any modifications. + /// Derived classes must implement a static function named GetUnequalTestCases + /// which returns object configurations that are different from the values in + /// . + /// + /// + /// private class ConcreteEqualGuideLines : EqualsGuidelinesTestFixture<T, TDerived> + /// { + /// protected override T CreateObject() + /// { + /// // Returns a base configuration + /// } + /// + /// protected override TDerived CreateDerivedObject() + /// { + /// // Returns a derived object with the same properties and values as CreateObject() + /// } + /// + /// private static IEnumerable<TestCaseData> GetUnequalTestCases() + /// { + /// // Returns object configurations that differ from CreateObject() + /// } + /// } + /// + /// + public abstract class EqualsGuidelinesTestFixture : EqualsGuidelinesTestFixture + where T : class + where TDerived : T + { + [Test] + public void Equals_ToDerivedObject_ReturnsFalse() + { + // Setup + T item1 = CreateObject(); + TDerived deriveditem = CreateDerivedObject(); + + // Call + bool itemEqualToDerivedItem = item1.Equals(deriveditem); + + // Assert + Assert.IsFalse(itemEqualToDerivedItem); + } + /// /// Creates a fully configured derived object with the same properties and values as - /// . + /// . /// /// A fully configured derived object of protected abstract TDerived CreateDerivedObject();