private static IssueCode GetIssueCode(ExpectedCase expectedCase) { switch (expectedCase) { case ExpectedCase.Any: return(null); case ExpectedCase.AllUpper: return(Codes[Code.Case_NotAllUpper]); case ExpectedCase.AllLower: return(Codes[Code.Case_NotAllLower]); case ExpectedCase.Mixed: return(Codes[Code.Case_NotMixed]); case ExpectedCase.NotAllUpper: return(Codes[Code.Case_AllUpper]); case ExpectedCase.NotAllLower: return(Codes[Code.Case_AllLower]); default: throw new ArgumentOutOfRangeException(); } }
public QaSchemaFieldAliases( [Doc(nameof(DocStrings.QaSchemaFieldAliases_table))][NotNull] ITable table, [Doc(nameof(DocStrings.QaSchemaFieldAliases_maximumLength))] int maximumLength, [Doc(nameof(DocStrings.QaSchemaFieldAliases_expectedCase))] ExpectedCase expectedCase, [Doc(nameof(DocStrings.QaSchemaFieldAliases_requireUniqueAliasNames))] bool requireUniqueAliasNames, [Doc(nameof(DocStrings.QaSchemaFieldAliases_allowCustomSystemFieldAlias))] bool allowCustomSystemFieldAlias, [Doc(nameof(DocStrings.QaSchemaFieldAliases_expectedDifference))] ExpectedStringDifference expectedDifference) : base(table) { Assert.ArgumentNotNull(table, nameof(table)); _table = table; _maximumLength = maximumLength; _expectedCase = expectedCase; _requireUniqueAliasNames = requireUniqueAliasNames; _allowCustomSystemFieldAlias = allowCustomSystemFieldAlias; _expectedDifference = expectedDifference; }
public QaSchemaFieldNames( [Doc(nameof(DocStrings.QaSchemaFieldNames_table))][NotNull] ITable table, [Doc(nameof(DocStrings.QaSchemaFieldNames_maximumLength))] int maximumLength, [Doc(nameof(DocStrings.QaSchemaFieldNames_expectedCase))] ExpectedCase expectedCase, [Doc(nameof(DocStrings.QaSchemaFieldNames_uniqueSubstringLength))] int uniqueSubstringLength) : base(table) { _table = table; _maximumLength = maximumLength; _expectedCase = expectedCase; _uniqueSubstringLength = uniqueSubstringLength; }
public QaSchemaFieldAliases( [Doc(nameof(DocStrings.QaSchemaFieldAliases_table))][NotNull] ITable table, [Doc(nameof(DocStrings.QaSchemaFieldAliases_maximumLength))] int maximumLength, [Doc(nameof(DocStrings.QaSchemaFieldAliases_expectedCase))] ExpectedCase expectedCase, [Doc(nameof(DocStrings.QaSchemaFieldAliases_requireUniqueAliasNames))] bool requireUniqueAliasNames, [Doc(nameof(DocStrings.QaSchemaFieldAliases_allowCustomSystemFieldAlias))] bool allowCustomSystemFieldAlias) : this(table, maximumLength, expectedCase, requireUniqueAliasNames, allowCustomSystemFieldAlias, // ReSharper disable once IntroduceOptionalParameters.Global ExpectedStringDifference.Any) { }
private static IList <QaError> GetErrors([NotNull] string tableName, int maximumLength, ExpectedCase expectedCase, int uniqueSubstringLength) { var locator = TestDataUtils.GetTestDataLocator(); string path = locator.GetPath("QaSchemaTests.mdb"); IFeatureWorkspace workspace = WorkspaceUtils.OpenPgdbFeatureWorkspace(path); ITable table = workspace.OpenTable(tableName); var test = new QaSchemaFieldNames(table, maximumLength, expectedCase, uniqueSubstringLength); var runner = new QaTestRunner(test); runner.Execute(); return(runner.Errors); }
public QaSchemaFieldDomainNames( [Doc(nameof(DocStrings.QaSchemaFieldDomainNames_table))][NotNull] ITable table, [Doc(nameof(DocStrings.QaSchemaFieldDomainNames_expectedPrefix))][CanBeNull] string expectedPrefix, [Doc(nameof(DocStrings.QaSchemaFieldDomainNames_maximumLength))] int maximumLength, [Doc(nameof(DocStrings.QaSchemaFieldDomainNames_mustContainFieldName))] bool mustContainFieldName, [Doc(nameof(DocStrings.QaSchemaFieldDomainNames_expectedCase))] ExpectedCase expectedCase) : base(table) { Assert.ArgumentNotNull(table, nameof(table)); _table = table; _expectedPrefix = expectedPrefix; _maximumLength = maximumLength; _mustContainFieldName = mustContainFieldName; _expectedCase = expectedCase; }
private static IList <QaError> GetErrors([NotNull] string tableName, int maximumLength, ExpectedCase expectedCase, bool requireUnique, bool allowCustomSystemFieldAlias, ExpectedStringDifference expectedStringDifference) { var locator = TestDataUtils.GetTestDataLocator(); string path = locator.GetPath("QaSchemaTests.mdb"); IFeatureWorkspace workspace = WorkspaceUtils.OpenPgdbFeatureWorkspace(path); ITable table = workspace.OpenTable(tableName); var test = new QaSchemaFieldAliases(table, maximumLength, expectedCase, requireUnique, allowCustomSystemFieldAlias, expectedStringDifference); var runner = new QaTestRunner(test); runner.Execute(); return(runner.Errors); }
public static bool HasExpectedCase([NotNull] string text, ExpectedCase expectedCase, [NotNull] string propertyName, [NotNull] out string message) { Assert.ArgumentNotNull(text, nameof(text)); Assert.ArgumentNotNull(propertyName, nameof(propertyName)); message = string.Empty; switch (expectedCase) { case ExpectedCase.Any: return(true); case ExpectedCase.AllUpper: if (!Equals(text, text.ToUpper())) { message = string.Format( LocalizableStrings.SchemaTestUtils_CaseAllUppercase, StringUtils.ToProperCase(propertyName), text); return(false); } return(true); case ExpectedCase.AllLower: if (!Equals(text, text.ToLower())) { message = string.Format( LocalizableStrings.SchemaTestUtils_CaseAllLowercase, StringUtils.ToProperCase(propertyName), text); return(false); } return(true); case ExpectedCase.Mixed: if (Equals(text, text.ToUpper()) || Equals(text, text.ToLower())) { message = string.Format( LocalizableStrings.SchemaTestUtils_CaseMixedCase, StringUtils.ToProperCase(propertyName), text); return(false); } return(true); case ExpectedCase.NotAllUpper: if (Equals(text, text.ToUpper())) { message = string.Format( LocalizableStrings.SchemaTestUtils_CaseNotAllUppercase, StringUtils.ToProperCase(propertyName), text); return(false); } return(true); case ExpectedCase.NotAllLower: if (Equals(text, text.ToLower())) { message = string.Format( LocalizableStrings.SchemaTestUtils_CaseNotAllLowercase, StringUtils.ToProperCase(propertyName), text); return(false); } return(true); default: throw new ArgumentOutOfRangeException(nameof(expectedCase), expectedCase, @"Illegal expected case value"); } }