コード例 #1
0
 public FixtureInstanceTestHost(ReflectionTestFixtureBuilder builder)
     : base(TestPathType.Instance, null, TestPath.GetFriendlyName(builder.Type.AsType()),
            builder.Type.AsType(), builder.Type.AsType(),
            TestFlags.ContinueOnError | TestFlags.Hidden | TestFlags.PathHidden)
 {
     Builder = builder;
 }
コード例 #2
0
 public ReflectionPropertyHost(ReflectionTestFixtureBuilder fixture,
                               PropertyInfo prop, ParameterizedTestHost host)
     : base(prop.Name, prop.PropertyType.GetTypeInfo(), host.Serializer, host.Flags)
 {
     Fixture  = fixture;
     Property = prop;
     Host     = host;
 }
コード例 #3
0
 public ReflectionTestCaseBuilder(ReflectionTestFixtureBuilder fixture, AsyncTestAttribute attr, MethodInfo method)
     : base(TestSerializer.TestCaseIdentifier, method.Name, GetParameter(method))
 {
     Fixture   = fixture;
     Attribute = attr;
     Method    = method;
     filter    = ReflectionHelper.CreateTestFilter(fixture.Filter, ReflectionHelper.GetMethodInfo(method));
 }
コード例 #4
0
        internal static TestHost ResolveParameter(ReflectionTestFixtureBuilder builder, PropertyInfo member)
        {
            var host = ResolveParameter(builder, new _PropertyInfo(member));

            if (host != null)
            {
                return(host);
            }

            throw new InternalErrorException();
        }
コード例 #5
0
ファイル: ReflectionHelper.cs プロジェクト: Roykens/web-tests
        static TestHost ResolveParameter(
            ReflectionTestFixtureBuilder fixture, IMemberInfo member)
        {
            if (typeof(ITestInstance).GetTypeInfo().IsAssignableFrom(member.Type))
            {
                var hostAttr = member.GetCustomAttribute <TestHostAttribute> ();
                if (hostAttr == null)
                {
                    hostAttr = member.Type.GetCustomAttribute <TestHostAttribute> ();
                }
                if (hostAttr == null)
                {
                    throw new InternalErrorException();
                }

                return(CreateCustomHost(fixture.Type, member, hostAttr));
            }

            var paramAttrs = member.GetCustomAttributes <TestParameterAttribute> ().ToArray();

            if (paramAttrs.Length == 1)
            {
                return(CreateParameterAttributeHost(fixture.Type, member, paramAttrs[0]));
            }
            else if (paramAttrs.Length > 1)
            {
                throw new InternalErrorException();
            }

            var typeAttr = GetCustomAttributeForType <TestParameterAttribute> (member.Type);

            if (typeAttr != null)
            {
                return(CreateParameterAttributeHost(fixture.Type, member, typeAttr));
            }

            if (member.Type.AsType().Equals(typeof(bool)))
            {
                return(CreateBoolean(member));
            }

            if (member.Type.IsEnum)
            {
                return(CreateEnum(member));
            }

            throw new InternalErrorException();
        }
コード例 #6
0
ファイル: ReflectionHelper.cs プロジェクト: Roykens/web-tests
 internal static TestHost ResolveParameter(
     ReflectionTestFixtureBuilder builder, PropertyInfo member)
 {
     return(ResolveParameter(builder, new _PropertyInfo(member)));
 }
コード例 #7
0
 public FixtureInstanceTestHost(ReflectionTestFixtureBuilder builder)
     : base(TestSerializer.FixtureInstanceIdentifier, null, builder.Type.AsType(), builder.Type.AsType(),
            TestFlags.ContinueOnError | TestFlags.PathHidden | TestFlags.Hidden)
 {
     Builder = builder;
 }