Lucene.Net.Tests.Classification: Added API consistency tests
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/c84e63a7 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/c84e63a7 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/c84e63a7 Branch: refs/heads/api-work Commit: c84e63a792b1dcd8e8df93bc312f05391d94434c Parents: ba13cf4 Author: Shad Storhaug <[email protected]> Authored: Wed Feb 1 17:01:51 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Wed Feb 1 17:01:51 2017 +0700 ---------------------------------------------------------------------- .../Lucene.Net.Tests.Classification.csproj | 1 + .../TestApiConsistency.cs | 120 +++++++++++++++++++ 2 files changed, 121 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c84e63a7/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj b/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj index d302a0f..0eec295 100644 --- a/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj +++ b/src/Lucene.Net.Tests.Classification/Lucene.Net.Tests.Classification.csproj @@ -43,6 +43,7 @@ <Compile Include="KNearestNeighborClassifierTest.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SimpleNaiveBayesClassifierTest.cs" /> + <Compile Include="TestApiConsistency.cs" /> <Compile Include="Utils\DataSplitterTest.cs" /> </ItemGroup> <ItemGroup> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c84e63a7/src/Lucene.Net.Tests.Classification/TestApiConsistency.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Classification/TestApiConsistency.cs b/src/Lucene.Net.Tests.Classification/TestApiConsistency.cs new file mode 100644 index 0000000..05c7f76 --- /dev/null +++ b/src/Lucene.Net.Tests.Classification/TestApiConsistency.cs @@ -0,0 +1,120 @@ +using Lucene.Net.Attributes; +using Lucene.Net.Util; +using NUnit.Framework; +using System; + +namespace Lucene.Net.Classification +{ + /// <summary> + /// LUCENENET specific tests for ensuring API conventions are followed + /// </summary> + public class TestApiConsistency : ApiScanTestBase + { + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestProtectedFieldNames(Type typeFromTargetAssembly) + { + base.TestProtectedFieldNames(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestPrivateFieldNames(Type typeFromTargetAssembly) + { + base.TestPrivateFieldNames(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestPublicFields(Type typeFromTargetAssembly) + { + base.TestPublicFields(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestMethodParameterNames(Type typeFromTargetAssembly) + { + base.TestMethodParameterNames(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestInterfaceNames(Type typeFromTargetAssembly) + { + base.TestInterfaceNames(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestClassNames(Type typeFromTargetAssembly) + { + base.TestClassNames(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForPropertiesWithNoGetter(Type typeFromTargetAssembly) + { + base.TestForPropertiesWithNoGetter(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForPropertiesThatReturnArray(Type typeFromTargetAssembly) + { + base.TestForPropertiesThatReturnArray(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForMethodsThatReturnWritableArray(Type typeFromTargetAssembly) + { + base.TestForMethodsThatReturnWritableArray(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForPublicMembersContainingComparer(Type typeFromTargetAssembly) + { + base.TestForPublicMembersContainingComparer(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForPublicMembersNamedSize(Type typeFromTargetAssembly) + { + base.TestForPublicMembersNamedSize(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForPublicMembersContainingNonNetNumeric(Type typeFromTargetAssembly) + { + base.TestForPublicMembersContainingNonNetNumeric(typeFromTargetAssembly); + } + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForPublicMembersWithNullableEnum(Type typeFromTargetAssembly) + { + base.TestForPublicMembersWithNullableEnum(typeFromTargetAssembly); + } + + // LUCENENET NOTE: This test is only for identifying members who were changed from + // ICollection, IList or ISet to IEnumerable during the port (that should be changed back) + //[Test, LuceneNetSpecific] + //[TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + //public override void TestForMembersAcceptingOrReturningIEnumerable(Type typeFromTargetAssembly) + //{ + // base.TestForMembersAcceptingOrReturningIEnumerable(typeFromTargetAssembly); + //} + + [Test, LuceneNetSpecific] + [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))] + public override void TestForMembersAcceptingOrReturningListOrDictionary(Type typeFromTargetAssembly) + { + base.TestForMembersAcceptingOrReturningListOrDictionary(typeFromTargetAssembly); + } + } +}
