Beispiel #1
0
        public void GetTestsShouldNotReturnHiddenTestMethodsFromAnyLevel()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummySecondHidingTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            Assert.IsNotNull(tests);
            Assert.AreEqual(
                1,
                tests.Count(t => t.TestMethod.Name == "BaseTestMethod"),
                "DummySecondHidingTestClass hides BaseTestMethod so it should be discovered.");
            Assert.AreEqual(
                1,
                tests.Count(t => t.TestMethod.Name == "DerivedTestMethod"),
                "DummySecondHidingTestClass hides DerivedTestMethod so it should be discovered.");
            Assert.IsFalse(
                tests.Any(t => t.TestMethod.DeclaringClassFullName == typeof(DummyBaseTestClass).FullName),
                "DummySecondHidingTestClass hides all base test methods so declaring class should not be any base class");
            Assert.IsFalse(
                tests.Any(t => t.TestMethod.DeclaringClassFullName == typeof(DummyHidingTestClass).FullName),
                "DummySecondHidingTestClass hides all base test methods so declaring class should not be any base class");
            Assert.IsFalse(
                tests.Any(t => t.TestMethod.DeclaringClassFullName == typeof(DummyOverridingTestClass).FullName),
                "DummySecondHidingTestClass hides all base test methods so declaring class should not be any base class");
        }
Beispiel #2
0
        public void GetTestsShouldNotReturnBaseTestMethodsFromAnotherAssemblyByConfiguration()
        {
            string runSettingxml =
                @"<RunSettings>   
                <MSTestV2>
                  <CaptureTraceOutput>true</CaptureTraceOutput>
                  <MapInconclusiveToFailed>false</MapInconclusiveToFailed>
                  <EnableBaseClassTestMethodsFromOtherAssemblies>false</EnableBaseClassTestMethodsFromOtherAssemblies>
              </MSTestV2>
            </RunSettings>";

            var mockRunContext  = new Mock <IRunContext>();
            var mockRunSettings = new Mock <IRunSettings>();

            mockRunContext.Setup(dc => dc.RunSettings).Returns(mockRunSettings.Object);
            mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingxml);

            MSTestSettings.PopulateSettings(mockRunContext.Object);
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: false);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            Assert.IsNotNull(tests);
            Assert.IsTrue(
                tests.All(t => t.TestMethod.Name != "BaseTestMethod"),
                "DummyDerivedFromRemoteTestClass inherits DummyRemoteBaseTestClass from different assembly. BestTestMethod from DummyRemoteBaseTestClass should not be discovered when RunSettings MSTestV2 specifies EnableBaseClassTestMethodsFromOtherAssemblies = false.");
        }
 public int GetCount(Type t)
 {
     int result = 0;
     TypeEnumerator typeEnumerator = GetEnumerator(t);
     while (typeEnumerator.MoveNext())
         result++;
     return result;
 }
Beispiel #4
0
        public void EnumerateShouldReturnEmptyCollectionWhenNoValidTestMethodsExist()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: false, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), string.Empty);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            Assert.IsNotNull(tests);
            Assert.AreEqual(0, tests.Count);
        }
        public void IsIgnoreAttributeOnTestClassReturnsFalseIfIgnoreIsNotSetOnTestClass()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameType: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");

            // Setup mocks
            this.mockReflectHelper.Setup(rh => rh.IsAttributeDefined(typeof(DummyTestClass), typeof(UTF.IgnoreAttribute), It.IsAny <bool>())).Returns(false);

            Assert.IsFalse(typeEnumerator.IsIgnoreAttributeOnTestClass);
        }
        public void GetTestsShouldReturnBaseTestMethodsInSameAssembly()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            var methodCount = typeof(DummyDerivedTestClass).GetMethods(BindingFlags.Instance | BindingFlags.Public).Count(m => m.DeclaringType.Assembly == typeof(DummyDerivedTestClass).Assembly);

            Assert.IsNotNull(tests);
            Assert.AreEqual(methodCount, tests.Count);
        }
Beispiel #7
0
        public void GetTestFromMethodShouldSetWorkItemIds()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            this.mockReflectHelper.Setup(rh => rh.GetCustomAttributes(methodInfo, typeof(UTF.WorkItemAttribute))).Returns(new Attribute[] { new UTF.WorkItemAttribute(123), new UTF.WorkItemAttribute(345) });

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            CollectionAssert.AreEqual(new string[] { "123", "345" }, testElement.WorkItemIds);
        }
Beispiel #8
0
        public void GetTestFromMethodShouldSetWorkItemIdsToNullIfNotAny()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            this.mockReflectHelper.Setup(rh => rh.GetCustomAttributes(methodInfo, typeof(UTF.WorkItemAttribute))).Returns(new Attribute[0]);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNull(testElement.WorkItemIds);
        }
Beispiel #9
0
        public void GetTestFromMethodShouldSetCssProjectStructure()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            this.mockReflectHelper.Setup(rh => rh.GetCustomAttribute(methodInfo, typeof(UTF.CssProjectStructureAttribute))).Returns(new UTF.CssProjectStructureAttribute("ProjectStructure123"));

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.AreEqual("ProjectStructure123", testElement.CssProjectStructure);
        }
Beispiel #10
0
        public void GetTestsShouldReturnBaseTestMethodsInSameAssembly()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            Assert.IsNotNull(tests);
            Assert.IsTrue(
                tests.Any(t => t.TestMethod.Name == "BaseTestMethod"),
                "DummyDerivedTestClass inherits DummyBaseTestClass from same assembly. BestTestMethod from DummyBaseTestClass should be discovered.");
        }
Beispiel #11
0
        public void GetTestsShouldReturnDeclaredTestMethods()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyBaseTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            Assert.IsNotNull(tests);
            Assert.IsTrue(
                tests.Any(t => t.TestMethod.Name == "BaseTestMethod"),
                "DummyBaseTestClass declares BaseTestMethod directly so it should always be discovered.");
        }
Beispiel #12
0
        public void GetTestFromMethodShouldInitiateTestMethodWithCorrectParameters()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");

            var testElement = typeEnumerator.GetTestFromMethod(typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType"), true, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.AreEqual("MethodWithVoidReturnType", testElement.TestMethod.Name);
            Assert.AreEqual(typeof(DummyTestClass).FullName, testElement.TestMethod.FullClassName);
            Assert.AreEqual("DummyAssemblyName", testElement.TestMethod.AssemblyName);
            Assert.IsFalse(testElement.TestMethod.IsAsync);
        }
Beispiel #13
0
        public void GetTestsShouldNotReturnBaseTestMethodsFromAnotherAssemblyByDefault()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: false);

            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            Assert.IsNotNull(tests);
            Assert.IsTrue(
                tests.All(t => t.TestMethod.Name != "BaseTestMethod"),
                "DummyDerivedFromRemoteTestClass inherits DummyRemoteBaseTestClass from different assembly. BestTestMethod from DummyRemoteBaseTestClass should not be discovered by default.");
        }
Beispiel #14
0
        public void GetTestFromMethodShouldSetDoNotParallelize()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            // Setup mocks
            this.mockReflectHelper.Setup(rh => rh.GetCustomAttributes(It.IsAny <MemberInfo>(), typeof(UTF.DoNotParallelizeAttribute))).Returns(new[] { new UTF.DoNotParallelizeAttribute() });

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.IsTrue(testElement.DoNotParallelize);
        }
Beispiel #15
0
        public void GetTestFromMethodShouldSetPriority()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            // Setup mocks
            this.mockReflectHelper.Setup(rh => rh.GetPriority(methodInfo)).Returns(1);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.AreEqual(1, testElement.Priority);
        }
Beispiel #16
0
        /// <summary>
        ///     Serializes the specified writer.
        /// </summary>
        /// <param name="serializer"> The serializer. </param>
        /// <param name="writer"> The writer. </param>
        /// <param name="value"> The value. </param>
        /// <param name="element"> The element. </param>
        public static void Serialize(this XmlSerializer serializer, XmlWriter writer, object value, string element)
        {
            if (value == null)
            {
                return;
            }

            try
            {
                if (value.GetType( )
                    .IsPrimitive || value is Guid || value is string)
                {
                    writer.WriteStartElement(element);

                    writer.WriteStartAttribute("Type");
                    writer.WriteValue(value.GetType( )
                                      .IsPrimitive ? TypeEnumerator.GetShortTypeNameFor(value.GetType( )) : value.GetType( )
                                      .AssemblyQualifiedName);
                    writer.WriteEndAttribute( );

                    writer.WriteStartAttribute("Value");
                    writer.WriteValue(Convert.ToString(value));
                    writer.WriteEndAttribute( );
                }
                else
                {
                    var xmlSerializer = new XmlSerializer(value.GetType( ));

                    writer.WriteStartElement(element);

                    writer.WriteStartAttribute("Type");
                    writer.WriteValue(value.GetType( )
                                      .IsPrimitive ? TypeEnumerator.GetShortTypeNameFor(value.GetType( )) : value.GetType( )
                                      .AssemblyQualifiedName);
                    writer.WriteEndAttribute( );

                    xmlSerializer.Serialize(writer, value);
                }
            }
            catch
            {
                // object cannot be serialized
                if (Log.IsWarnEnabled)
                {
                    Log.WarnFormat("Object Type : {0} cannot be XmlSerialized", value.GetType( ));
                }
            }

            writer.WriteEndElement( );
        }
        public void GetTestsShouldNotReturnBaseTestMethodsFromAnotherAssembly()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            // This would return basic object methods like ToString() as well.
            var methodCount =
                typeof(DummyDerivedTestClass).GetMethods(BindingFlags.Instance | BindingFlags.Public).Count();

            Assert.IsNotNull(tests);
            Assert.IsTrue(methodCount > tests.Count);
        }
Beispiel #18
0
        public void GetTestFromMethodShouldInitializeAsyncTypeNameCorrectly()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("AsyncMethodWithTaskReturnType");

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            var expectedAsyncTaskName =
                (methodInfo.GetCustomAttribute(typeof(AsyncStateMachineAttribute)) as AsyncStateMachineAttribute)
                .StateMachineType.FullName;

            Assert.IsNotNull(testElement);
            Assert.AreEqual(expectedAsyncTaskName, testElement.AsyncTypeName);
        }
Beispiel #19
0
        public void GetTestFromMethodShouldSetDisplayNameFromAttribute()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod(nameof(DummyTestClass.MethodWithVoidReturnType));

            // Setup mocks to behave like we have [TestMethod("Test method display name.")] attribute on the method
            this.mockReflectHelper.Setup(
                rh => rh.GetCustomAttribute(methodInfo, typeof(TestMethodV2))).Returns(new TestMethodV2("Test method display name."));

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.AreEqual("Test method display name.", testElement.DisplayName);
        }
Beispiel #20
0
        public void GetTestFromMethodShouldSetTestCategory()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");
            var            testCategories = new string[] { "foo", "bar" };

            // Setup mocks
            this.mockReflectHelper.Setup(rh => rh.GetCategories(methodInfo, typeof(DummyTestClass))).Returns(testCategories);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            CollectionAssert.AreEqual(testCategories, testElement.TestCategory);
        }
Beispiel #21
0
        public static string ToSerializableForm(this MethodInfo method)
        {
            string serializableName = TypeEnumerator.GetShortTypeNameFor(method.DeclaringType) + Environment.NewLine;

            if (!method.IsGenericMethod)
            {
                serializableName += method.ToString( );
            }
            else
            {
                serializableName += method.GetGenericMethodDefinition( ) + Environment.NewLine +
                                    String.Join(Environment.NewLine, method.GetGenericArguments( ).Select(ty => ty.ToSerializableForm( )).ToArray( ));
            }

            return(serializableName);
        }
Beispiel #22
0
        public void GetTestFromMethodShouldSetDeploymentItemsToNullIfNotPresent()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            // Setup mocks
            this.testablePlatformServiceProvider.MockTestDeployment.Setup(
                td => td.GetDeploymentItems(It.IsAny <MethodInfo>(), It.IsAny <Type>(), this.warnings))
            .Returns((KeyValuePair <string, string>[])null);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.IsNull(testElement.DeploymentItems);
        }
Beispiel #23
0
        public void GetTestFromMethodShouldFillTraitsWithTestProperties()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");
            var            testProperties = new List <Trait> {
                new Trait("foo", "bar"), new Trait("fooprime", "barprime")
            };

            // Setup mocks
            this.mockReflectHelper.Setup(rh => rh.GetTestPropertiesAsTraits(methodInfo)).Returns(testProperties);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            CollectionAssert.AreEqual(testProperties, testElement.Traits);
        }
Beispiel #24
0
        public void GetTestFromMethodShouldSetDeploymentItems()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator  = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo      = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");
            var            deploymentItems = new[] { new KeyValuePair <string, string>("C:\\temp", string.Empty) };

            // Setup mocks
            this.testablePlatformServiceProvider.MockTestDeployment.Setup(
                td => td.GetDeploymentItems(methodInfo, typeof(DummyTestClass), this.warnings)).Returns(deploymentItems);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.IsNotNull(testElement.DeploymentItems);
            CollectionAssert.AreEqual(deploymentItems, testElement.DeploymentItems.ToArray());
        }
Beispiel #25
0
        public void GetTestFromMethodShouldSetIgnoredPropertyToFalseIfNotSetOnTestClassAndTestMethod()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            // Setup mocks
            this.mockReflectHelper.Setup(
                rh => rh.IsAttributeDefined(typeof(DummyTestClass), typeof(UTF.IgnoreAttribute), false)).Returns(false);
            this.mockReflectHelper.Setup(
                rh => rh.IsAttributeDefined(methodInfo, typeof(UTF.IgnoreAttribute), false)).Returns(false);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, true, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.IsFalse(testElement.Ignored);
        }
Beispiel #26
0
        public void GetTestFromMethodShouldSetDeclaringAssemblyName()
        {
            const bool isMethodFromSameAssemly = false;

            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyTestClass), "DummyAssemblyName");
            var            methodInfo     = typeof(DummyTestClass).GetMethod("MethodWithVoidReturnType");

            // Setup mocks
            string otherAssemblyName = "ADifferentAssembly";

            this.testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.GetAssemblyPath(It.IsAny <Assembly>()))
            .Returns(otherAssemblyName);

            var testElement = typeEnumerator.GetTestFromMethod(methodInfo, isMethodFromSameAssemly, this.warnings);

            Assert.IsNotNull(testElement);
            Assert.AreEqual(otherAssemblyName, testElement.TestMethod.DeclaringAssemblyName);
        }
Beispiel #27
0
        public void GetTestsShouldReturnOverriddenTestMethods()
        {
            this.SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true);
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(DummyOverridingTestClass), Assembly.GetExecutingAssembly().FullName);

            var tests = typeEnumerator.Enumerate(out this.warnings);

            Assert.IsNotNull(tests);
            Assert.AreEqual(
                1,
                tests.Count(t => t.TestMethod.Name == "BaseTestMethod"),
                "DummyOverridingTestClass inherits BaseTestMethod so it should be discovered.");
            Assert.AreEqual(
                1,
                tests.Count(t => t.TestMethod.Name == "DerivedTestMethod"),
                "DummyOverridingTestClass overrides DerivedTestMethod directly so it should always be discovered.");
            Assert.AreEqual(
                typeof(DummyHidingTestClass).FullName,
                tests.Single(t => t.TestMethod.Name == "BaseTestMethod").TestMethod.DeclaringClassFullName,
                "DummyOverridingTestClass inherits BaseTestMethod from DummyHidingTestClass specifically.");
            Assert.IsNull(
                tests.Single(t => t.TestMethod.Name == "DerivedTestMethod").TestMethod.DeclaringClassFullName,
                "DummyOverridingTestClass overrides DerivedTestMethod so is the declaring class.");
        }
Beispiel #28
0
 public static string ToSerializableForm(this MemberInfo member)
 {
     //return member.DeclaringType.AssemblyQualifiedName + Environment.NewLine + member;
     return(TypeEnumerator.GetShortTypeNameFor(member.DeclaringType) + Environment.NewLine + member);
 }
Beispiel #29
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "SystemVariable" /> class.
 /// </summary>
 /// <param name = "type">The type.</param>
 public SystemVariable(Type type)
 {
     SystemType = TypeEnumerator.GetQualifiedNamesFor(type);
 }
Beispiel #30
0
        public void EnumerateShouldReturnNullIfTypeIsNotValid()
        {
            TypeEnumerator typeEnumerator = this.GetTypeEnumeratorInstance(typeof(IDummyInterface), string.Empty);

            Assert.IsNull(typeEnumerator.Enumerate(out this.warnings));
        }