public void TestFieldsForEqualsAndGetHashCode()
 {
     ReflectionAssert.AssertPublicAndInternalFieldsAndProperties(
         typeof(CSharpParseOptions),
         "Features",
         "LanguageVersion",
         "PreprocessorSymbolNames",
         "PreprocessorSymbols");
 }
Example #2
0
 public void HandleNullPropagation_Property_RoundTrips()
 {
     ReflectionAssert.EnumProperty <ODataQuerySettings, HandleNullPropagationOption>(
         new ODataQuerySettings(),
         o => o.HandleNullPropagation,
         HandleNullPropagationOption.Default,
         HandleNullPropagationOption.Default - 1,
         HandleNullPropagationOption.True);
 }
 public void AllowedQueryOptions_Property_RoundTrips()
 {
     ReflectionAssert.EnumProperty <ODataValidationSettings, AllowedQueryOptions>(
         new ODataValidationSettings(),
         o => o.AllowedQueryOptions,
         expectedDefaultValue: AllowedQueryOptions.Supported,
         illegalValue: AllowedQueryOptions.All + 1,
         roundTripTestValue: AllowedQueryOptions.Filter);
 }
Example #4
0
 public void AllowedFunctions_Property_RoundTrips()
 {
     ReflectionAssert.EnumProperty <ODataValidationSettings, AllowedFunctions>(
         new ODataValidationSettings(),
         o => o.AllowedFunctions,
         expectedDefaultValue: AllowedFunctions.AllFunctions,
         illegalValue: AllowedFunctions.AllFunctions + 1,
         roundTripTestValue: AllowedFunctions.AllMathFunctions);
 }
Example #5
0
 public void TestFieldsForEqualsAndGetHashCode()
 {
     ReflectionAssert.AssertPublicAndInternalFieldsAndProperties(
         typeof(CSharpCompilationOptions),
         "Language",
         "AllowUnsafe",
         "Usings",
         "TopLevelBinderFlags");
 }
 public void AllowedLogicalOperators_Property_RoundTrips()
 {
     ReflectionAssert.EnumProperty <ODataValidationSettings, AllowedLogicalOperators>(
         new ODataValidationSettings(),
         o => o.AllowedLogicalOperators,
         expectedDefaultValue: AllowedLogicalOperators.All,
         illegalValue: AllowedLogicalOperators.All + 1,
         roundTripTestValue: AllowedLogicalOperators.GreaterThanOrEqual | AllowedLogicalOperators.LessThanOrEqual);
 }
Example #7
0
 public void AllowedArithmeticOperators_Property_RoundTrips()
 {
     ReflectionAssert.EnumProperty <ODataValidationSettings, AllowedArithmeticOperators>(
         new ODataValidationSettings(),
         o => o.AllowedArithmeticOperators,
         expectedDefaultValue: AllowedArithmeticOperators.All,
         illegalValue: AllowedArithmeticOperators.All + 1,
         roundTripTestValue: AllowedArithmeticOperators.Multiply);
 }
Example #8
0
 public void TestFieldsForEqualsAndGetHashCode()
 {
     ReflectionAssert.AssertPublicAndInternalFieldsAndProperties(
         typeof(ParseOptions),
         "DocumentationMode",
         "Features",
         "Kind",
         "PreprocessorSymbolNames");
 }
Example #9
0
        public void GeneratesTheRightType(IDataGenerator dg)
        {
            dg.NullProbability = 0;
            // generate row
            DataRow row = dg.Column.Table.NewRow();

            dg.GenerateData(row);
            Assert.IsFalse(row.HasErrors);
            // check that value has the right type
            ReflectionAssert.IsAssignableFrom(dg.GeneratedType, row[dg.Column].GetType());
        }
Example #10
0
 public void MaxSkip_Property_RoundTrips()
 {
     ReflectionAssert.NullableIntegerProperty <ODataValidationSettings, int>(
         new ODataValidationSettings(),
         o => o.MaxSkip,
         expectedDefaultValue: null,
         minLegalValue: 0,
         maxLegalValue: int.MaxValue,
         illegalLowerValue: -1,
         illegalUpperValue: null,
         roundTripTestValue: 2);
 }
Example #11
0
 public void MaxAnyAllExpressionDepth_Property_RoundTrips()
 {
     ReflectionAssert.IntegerProperty <ODataValidationSettings, int>(
         new ODataValidationSettings(),
         o => o.MaxAnyAllExpressionDepth,
         expectedDefaultValue: 1,
         minLegalValue: 1,
         maxLegalValue: int.MaxValue,
         illegalLowerValue: 0,
         illegalUpperValue: null,
         roundTripTestValue: 2);
 }
Example #12
0
 public void PageSize_Property_RoundTrips()
 {
     ReflectionAssert.NullableIntegerProperty <ODataQuerySettings, int>(
         new ODataQuerySettings(),
         o => o.PageSize,
         expectedDefaultValue: null,
         minLegalValue: 1,
         maxLegalValue: int.MaxValue,
         illegalLowerValue: 0,
         illegalUpperValue: null,
         roundTripTestValue: 2);
 }
Example #13
0
 public void MaxOrderByNodeCount_Property_RoundTrips()
 {
     ReflectionAssert.IntegerProperty(
         new ODataValidationSettings(),
         o => o.MaxOrderByNodeCount,
         expectedDefaultValue: 5,
         minLegalValue: 1,
         maxLegalValue: int.MaxValue,
         illegalLowerValue: -1,
         illegalUpperValue: null,
         roundTripTestValue: 100);
 }
Example #14
0
 public void MaxExpansionDepth_Property_RoundTrips()
 {
     ReflectionAssert.IntegerProperty(
         new ODataValidationSettings(),
         o => o.MaxExpansionDepth,
         expectedDefaultValue: 2,
         minLegalValue: 0,
         maxLegalValue: int.MaxValue,
         illegalLowerValue: -1,
         illegalUpperValue: null,
         roundTripTestValue: 100);
 }
 public void MaxNodeCount_Property_RoundTrips()
 {
     // Arrange & Act & Assert
     ReflectionAssert.IntegerProperty <ODataValidationSettings, int>(
         new ODataValidationSettings(),
         o => o.MaxNodeCount,
         expectedDefaultValue: 100,
         minLegalValue: 1,
         maxLegalValue: int.MaxValue,
         illegalLowerValue: 0,
         illegalUpperValue: null,
         roundTripTestValue: 2);
 }
Example #16
0
        public static void CheckSignature(MethodInfo mi, Type returnType)
        {
            if (mi == null)
            {
                throw new ArgumentNullException("mi");
            }
            if (returnType == null)
            {
                throw new ArgumentNullException("returnType");
            }

            ReflectionAssert.IsAssignableFrom(returnType, mi.ReturnType);
            ParameterInfo[] pis = mi.GetParameters();
            Assert.AreEqual(pis.Length, 0);
        }
Example #17
0
 public void TestFieldsForEqualsAndGetHashCode()
 {
     ReflectionAssert.AssertPublicAndInternalFieldsAndProperties(
         typeof(EmitOptions),
         "EmitMetadataOnly",
         "SubsystemVersion",
         "FileAlignment",
         "HighEntropyVirtualAddressSpace",
         "BaseAddress",
         "DebugInformationFormat",
         "OutputNameOverride",
         "PdbFilePath",
         "RuntimeMetadataVersion",
         "TolerateErrors",
         "IncludePrivateMembers");
 }
Example #18
0
 public void TestFieldsForEqualsAndGetHashCode()
 {
     ReflectionAssert.AssertPublicAndInternalFieldsAndProperties(
         typeof(EmitOptions),
         nameof(EmitOptions.EmitTestCoverageData),
         nameof(EmitOptions.EmitMetadataOnly),
         nameof(EmitOptions.SubsystemVersion),
         nameof(EmitOptions.FileAlignment),
         nameof(EmitOptions.HighEntropyVirtualAddressSpace),
         nameof(EmitOptions.BaseAddress),
         nameof(EmitOptions.DebugInformationFormat),
         nameof(EmitOptions.OutputNameOverride),
         nameof(EmitOptions.PdbFilePath),
         nameof(EmitOptions.RuntimeMetadataVersion),
         nameof(EmitOptions.TolerateErrors),
         nameof(EmitOptions.IncludePrivateMembers),
         nameof(EmitOptions.InstrumentationKinds));
 }
Example #19
0
        public Fixture(Type type, IRun run, MethodInfo setUp, MethodInfo tearDown, bool ignored)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (run == null)
            {
                throw new ArgumentNullException("run");
            }
            this.type = type;
            ReflectionAssert.HasDefaultConstructor(this.type);

            this.run      = run;
            this.setUp    = setUp;
            this.tearDown = tearDown;
            this.ignored  = ignored;
            this.starters = new RunPipeStarterCollection(this);
        }
 public void TestFieldsForEqualsAndGetHashCode()
 {
     ReflectionAssert.AssertPublicAndInternalFieldsAndProperties(
         typeof(CompilationOptions),
         "AssemblyIdentityComparer",
         "Language",
         "CheckOverflow",
         "ConcurrentBuild",
         "CryptoKeyContainer",
         "CryptoKeyFile",
         "CryptoPublicKey",
         "CurrentLocalTime",
         "DelaySign",
         "Deterministic",
         "EnableEditAndContinue",
         "Errors",
         "DebugPlusMode",
         "Features",
         "GeneralDiagnosticOption",
         "MainTypeName",
         "MetadataImportOptions",
         "MetadataReferenceResolver",
         "ModuleName",
         "NullableContextOptions",
         "OptimizationLevel",
         "OutputKind",
         "Platform",
         "PublicSign",
         "ReferencesSupersedeLowerVersions",
         "ScriptClassName",
         "SourceReferenceResolver",
         "SpecificDiagnosticOptions",
         "StrongNameProvider",
         "SyntaxTreeOptionsProvider",
         "ReportSuppressedDiagnostics",
         "WarningLevel",
         "XmlReferenceResolver"
         );
 }
Example #21
0
        public void Check(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            try
            {
                ReflectionAssert.IsAssignableFrom(this.returnType, method.ReturnType);
                ParameterInfo[] pis = method.GetParameters();
                Assert.AreEqual(this.parameters.Length, pis.Length,
                                "Parameters count are not equal");
                for (int i = 0; i < pis.Length; ++i)
                {
                    Assert.AreEqual(this.parameters[i], pis[i].ParameterType,
                                    "Parameter {0} is not of the same type");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Invalid method signature", ex);
            }
        }
Example #22
0
        public void Property_IsNullable()
        {
            TestEdmEnumObject edmObject = new TestEdmEnumObject(new EdmEnumType("NS", "Enum"), "test");

            ReflectionAssert.BooleanProperty(edmObject, e => e.IsNullable, expectedDefaultValue: false);
        }
Example #23
0
        public void Property_Instance_RoundTrips()
        {
            SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity>();

            ReflectionAssert.Property(wrapper, w => w.Instance, expectedDefaultValue: null, allowNull: true, roundTripTestValue: new TestEntity());
        }
Example #24
0
        public void Property_IsNullable()
        {
            EdmDeltaComplexObject edmObject = new EdmDeltaComplexObject(new EdmComplexType("NS", "Complex"));

            ReflectionAssert.BooleanProperty(edmObject, e => e.IsNullable, expectedDefaultValue: false);
        }
 static Assembly GetAssembly()
 {
     return(ReflectionAssert.AssemblyExists("Day1StandardDeviation.exe"));
 }
 public void Property_Url_RoundTrips()
 {
     ReflectionAssert.Property(_context, (c) => c.Url, null, allowNull: true, roundTripTestValue: new UrlHelper(new HttpRequestMessage()));
 }
 public void Property_SkipExpensiveAvailabilityChecks_RoundTrips()
 {
     ReflectionAssert.BooleanProperty(_context, (c) => c.SkipExpensiveAvailabilityChecks, false);
 }
 public void Property_SerializerContext_RoundTrips()
 {
     ReflectionAssert.Property(_context, (c) => c.SerializerContext, _context.SerializerContext, allowNull: true, roundTripTestValue: new ODataSerializerContext());
 }
 public void Property_StructuredType_RoundTrips()
 {
     ReflectionAssert.Property(_context, (c) => c.StructuredType, null, allowNull: true, roundTripTestValue: _entityType);
 }
 public void Property_NavigationSource_RoundTrips()
 {
     ReflectionAssert.Property(_context, (c) => c.NavigationSource, null, allowNull: true, roundTripTestValue: new Mock <IEdmEntitySet>().Object);
 }