Re-enable xunit warning 2018 (dotnet/corefx#39865)
authorStephen Toub <stoub@microsoft.com>
Tue, 30 Jul 2019 00:56:50 +0000 (20:56 -0400)
committerGitHub <noreply@github.com>
Tue, 30 Jul 2019 00:56:50 +0000 (20:56 -0400)
Commit migrated from https://github.com/dotnet/corefx/commit/fec76b0fc06b4fce9e4ac28b9a2bf1101209d984

src/libraries/CodeAnalysis.ruleset
src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Factories/ContainerFactory.cs
src/libraries/System.ComponentModel.Composition/tests/System/Integration/CompositionContainerAttributedModelCycleTests.cs

index 3298b4f..97a490c 100644 (file)
@@ -79,6 +79,5 @@
     <Rule Id="xUnit1026" Action="None" /> <!-- Theory methods should use all of their parameters -->
     <Rule Id="xUnit2013" Action="None" /> <!-- Do not use equality check to check for collection size. -->
     <Rule Id="xUnit2017" Action="None" /> <!-- Do not use Contains() to check if a value exists in a collection -->
-    <Rule Id="xUnit2018" Action="None" /> <!-- Do not compare an object's exact type to an abstract class or interface -->
   </Rules>
 </RuleSet>
index 22a10dd..a3a18b1 100644 (file)
@@ -45,20 +45,6 @@ namespace System.ComponentModel.Composition.Factories
             return Create(catalog);
         }
 
-        public static CompositionContainer CreateAttributed(params object[] parts)
-        {
-            var container = new CompositionContainer();
-            var partsArray = new ComposablePart[parts.Length];
-
-            for (int i = 0; i < parts.Length; i++)
-            {
-                Assert.IsNotType<Type>(parts[i]);
-                partsArray[i] = PartFactory.CreateAttributed(parts[i]);
-            }
-
-            return Create(partsArray);
-        }
-
         public static CompositionContainer Create(CompositionContainer parent, params ComposablePart[] parts)
         {
             CompositionContainer container;
index 52eb766..ff22f48 100644 (file)
@@ -125,7 +125,7 @@ namespace Tests.Integration
             {
                 var export = GetExport(type, types);
 
-                Assert.IsType<Type>(export.Value);
+                Assert.IsAssignableFrom<Type>(export.Value);
             }
         }