private static Type GetTestType([NotNull] TestDescriptor testDescriptor)
            {
                Assert.ArgumentNotNull(testDescriptor, nameof(testDescriptor));

                if (testDescriptor.TestClass != null)
                {
                    return(PrivateAssemblyUtils.LoadType(testDescriptor.TestClass.AssemblyName,
                                                         testDescriptor.TestClass.TypeName));
                }

                if (testDescriptor.TestFactoryDescriptor != null)
                {
                    return(testDescriptor.TestFactoryDescriptor.GetInstanceType());
                }

                return(null);
            }
Exemple #2
0
        public TestImplementationInfo([NotNull] string assemblyName,
                                      [NotNull] string typeName,
                                      int constructorId = 0)
        {
            Assert.ArgumentNotNull(assemblyName, nameof(assemblyName));
            Assert.ArgumentNotNull(typeName, nameof(typeName));

            _testType = PrivateAssemblyUtils.LoadType(assemblyName, typeName);

            if (_testType == null)
            {
                throw new TypeLoadException(
                          string.Format("{0} does not exist in {1}", typeName, assemblyName));
            }

            if (TestType.GetConstructors().Length <= constructorId)
            {
                throw new TypeLoadException(
                          string.Format("invalid constructorId {0}, {1} has {2} constructors",
                                        constructorId, typeName, TestType.GetConstructors().Length));
            }

            _constructorId = constructorId;
        }
Exemple #3
0
 public Type GetInstanceType()
 {
     return(PrivateAssemblyUtils.LoadType(_assemblyName, _typeName));
 }