public void SqlQueryBuilderWithObjectHierarchy_Use_SupportedODataQueryOptions_GetDefaultDataServiceV2_Contains_SubstringOf() { SqlQueryBuilderWithObjectHierarchy myClass = new SqlQueryBuilderWithObjectHierarchy('.'); var getSupportedODataQueryOptions = myClass.GetType().GetMethod("GetSupportedODataQueryOptions", BindingFlags.Static | BindingFlags.Public); var allowedFunctions = ((ODataValidationSettings)getSupportedODataQueryOptions.Invoke(null, null)).AllowedFunctions; Assert.IsTrue(allowedFunctions.HasFlag(AllowedFunctions.SubstringOf)); }
public void SqlQueryBuilderWithObjectHierarchy_Use_SupportedODataQueryOptions_GetDefaultDataServiceV2() { SqlQueryBuilderWithObjectHierarchy myClass = new SqlQueryBuilderWithObjectHierarchy('.'); var getSupportedODataQueryOptions = myClass.GetType().GetMethod("GetSupportedODataQueryOptions", BindingFlags.Static | BindingFlags.Public); var compareResult = new CompareLogic().Compare(getSupportedODataQueryOptions.Invoke(null, null), SupportedODataQueryOptions.GetDefaultDataServiceV2()); Assert.IsTrue(compareResult.AreEqual); }
public void SetMaxNodeCountFromConfigFile_sets_values([Values("123", "456")] string maxNodeCountCase) { ConfigurationManager.AppSettings["DynamicOData.ODataValidation.MaxNodeCount"] = maxNodeCountCase; SqlQueryBuilderWithObjectHierarchy myClass = new SqlQueryBuilderWithObjectHierarchy('.'); var method = myClass.GetType() .GetMethod("SetMaxNodeCountFromConfigFile", BindingFlags.Static | BindingFlags.NonPublic); method.Invoke(null, null); Assert.That(SqlQueryBuilderWithObjectHierarchy.GetSupportedODataQueryOptions().MaxNodeCount, Is.EqualTo(int.Parse(maxNodeCountCase))); }
public void SetMaxNodeCountFromConfigFile_doesnt_override_value_on_wrong_value([Values("", "-1")] string maxNodeCountTestCase) { int defaultValue = SqlQueryBuilderWithObjectHierarchy.GetSupportedODataQueryOptions().MaxNodeCount; ConfigurationManager.AppSettings["DynamicOData.ODataValidation.MaxNodeCount"] = maxNodeCountTestCase; SqlQueryBuilderWithObjectHierarchy myClass = new SqlQueryBuilderWithObjectHierarchy('.'); var method = myClass.GetType() .GetMethod("SetMaxNodeCountFromConfigFile", BindingFlags.Static | BindingFlags.NonPublic); method.Invoke(null, null); Assert.That(SqlQueryBuilderWithObjectHierarchy.GetSupportedODataQueryOptions().MaxNodeCount, Is.EqualTo(defaultValue)); }
public void SqlQueryBuilderWithObjectHierarchy_Use_SupportedODataQueryOptions_from_parameter(AllowedArithmeticOperators allowedArithmeticOperators, AllowedFunctions allowedFunctions, AllowedLogicalOperators allowedLogicalOperators, AllowedQueryOptions allowedQueryOptions) { ODataValidationSettings dataValidationSettings = new ODataValidationSettings { AllowedArithmeticOperators = allowedArithmeticOperators, AllowedFunctions = allowedFunctions, AllowedLogicalOperators = allowedLogicalOperators, AllowedQueryOptions = allowedQueryOptions }; SqlQueryBuilderWithObjectHierarchy myClass = new SqlQueryBuilderWithObjectHierarchy('.', dataValidationSettings); var getSupportedODataQueryOptions = myClass.GetType().GetMethod("GetSupportedODataQueryOptions", BindingFlags.Static | BindingFlags.Public); var compareResult = new CompareLogic().Compare(getSupportedODataQueryOptions.Invoke(null, null), dataValidationSettings); Assert.IsTrue(compareResult.AreEqual); }