コード例 #1
0
 public CustomTestHost(string name, Type type, Type hostType, TestFlags flags, TestHostAttribute attr, bool useFixtureInstance)
     : base(name, name, type, hostType, flags)
 {
     HostType           = hostType;
     Attribute          = attr;
     UseFixtureInstance = useFixtureInstance;
 }
コード例 #2
0
ファイル: ReflectionHelper.cs プロジェクト: Roykens/web-tests
        static Type GetCustomHostType(
            TypeInfo fixtureType, IMemberInfo member, TestHostAttribute attr,
            out bool useFixtureInstance)
        {
            var hostType        = typeof(ITestHost <>).GetTypeInfo();
            var genericInstance = hostType.MakeGenericType(member.Type.AsType()).GetTypeInfo();

            if (attr.HostType != null)
            {
                if (!genericInstance.IsAssignableFrom(attr.HostType.GetTypeInfo()))
                {
                    throw new InternalErrorException();
                }
                useFixtureInstance = genericInstance.IsAssignableFrom(fixtureType);
                return(attr.HostType);
            }

            if (genericInstance.IsAssignableFrom(fixtureType))
            {
                useFixtureInstance = true;
                return(null);
            }

            throw new InternalErrorException();
        }
コード例 #3
0
ファイル: ReflectionHelper.cs プロジェクト: Roykens/web-tests
        static TestHost CreateCustomHost(TypeInfo fixture, IMemberInfo member, TestHostAttribute attr)
        {
            bool useFixtureInstance;
            var  hostType = GetCustomHostType(fixture, member, attr, out useFixtureInstance);

            return(new CustomTestHost(attr.Identifier ?? member.Name, member.Type.AsType(), hostType, attr.TestFlags, attr, useFixtureInstance));
        }
コード例 #4
0
ファイル: CustomTestHost.cs プロジェクト: stefb965/web-tests
 public CustomTestHost(string name, Type type, Type hostType, TestFlags flags,
                       TestHostAttribute attr, ITestHost <ITestInstance> staticHost, bool useFixtureInstance)
     : base(TestPathType.Parameter, name, name, type, hostType, flags)
 {
     HostType           = hostType;
     Attribute          = attr;
     StaticHost         = staticHost;
     UseFixtureInstance = useFixtureInstance;
 }