* Initial action for build

* Update test to use OrdinalIgnoreCase

* Switch to ordinalignorescase everywhere to be consistent with the service
This commit is contained in:
Sean Ferguson 2019-11-18 10:19:00 -08:00 коммит произвёл GitHub
Родитель d943b826b0
Коммит 7084e78972
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 54 добавлений и 31 удалений

23
.github/workflows/dotnetcore.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,23 @@
name: .NET Core
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.108
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test with dotnet
run: dotnet test

Просмотреть файл

@ -34,6 +34,6 @@ namespace Common
public ConcurrentDictionary<int, int> SourceToTargetIds { get; set; } = new ConcurrentDictionary<int, int>();
public ConcurrentSet<string> RemoteLinkRelationTypes { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> RemoteLinkRelationTypes { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
}
}

Просмотреть файл

@ -79,7 +79,7 @@ namespace Common
public static IEnumerable<T> GetInstances<T>()
{
var commonAssemblyName = DependencyContext.Default.GetDefaultAssemblyNames().Where(a => a.Name.Equals("Common", StringComparison.CurrentCultureIgnoreCase)).First();
var commonAssemblyName = DependencyContext.Default.GetDefaultAssemblyNames().Where(a => a.Name.Equals("Common", StringComparison.OrdinalIgnoreCase)).First();
var commonAssembly = Assembly.Load(commonAssemblyName);
return commonAssembly.GetExportedTypes().Where(a => !a.GetTypeInfo().IsAbstract && a.GetConstructor(Type.EmptyTypes) != null && !a.GetConstructor(Type.EmptyTypes).ContainsGenericParameters)

Просмотреть файл

@ -16,11 +16,11 @@ namespace Common.Migration
public ConcurrentDictionary<string, ISet<string>> WorkItemTypes { get; set; }
public ConcurrentDictionary<string, WorkItemField> SourceFields { get; set; } = new ConcurrentDictionary<string, WorkItemField>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentDictionary<string, WorkItemField> SourceFields { get; set; } = new ConcurrentDictionary<string, WorkItemField>(StringComparer.OrdinalIgnoreCase);
public ConcurrentDictionary<int, string> SourceToTags { get; set; } = new ConcurrentDictionary<int, string>();
public ISet<string> HtmlFieldReferenceNames { get; set; } = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ISet<string> HtmlFieldReferenceNames { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
public ISet<string> TargetAreaPaths { get; set; }
@ -28,9 +28,9 @@ namespace Common.Migration
public ISet<string> IdentityFields { get; set; }
public ConcurrentSet<string> ValidatedIdentities { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> ValidatedIdentities { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> InvalidIdentities { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> InvalidIdentities { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public IList<string> UnsupportedFields => unsupportedFields;

Просмотреть файл

@ -44,7 +44,7 @@ namespace Common.Migration
{
object identityObject = null;
string identityValue = null;
HashSet<string> identitiesToProcess = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);
HashSet<string> identitiesToProcess = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var sourceWorkItem in batchContext.SourceWorkItems)
{

Просмотреть файл

@ -36,7 +36,7 @@ namespace Common.Migration
private ISet<string> GetHtmlFieldReferenceNames(IList<WorkItemField> sourceWorkItemFields)
{
IEnumerable<WorkItemField> htmlFields = sourceWorkItemFields.Where(a => a.Type == FieldType.Html);
ISet<string> htmlFieldReferenceNames = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);
ISet<string> htmlFieldReferenceNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var field in htmlFields)
{
htmlFieldReferenceNames.Add(field.ReferenceName);

Просмотреть файл

@ -18,41 +18,41 @@ namespace Common.Validation
//Mapping of targetId of a work item to attribute id of the hyperlink
public ConcurrentDictionary<int, Int64> TargetIdToSourceHyperlinkAttributeId { get; set; } = new ConcurrentDictionary<int, Int64>();
public ISet<string> RequestedFields { get; } = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ISet<string> RequestedFields { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentDictionary<int, int> SourceWorkItemRevision { get; set; } = new ConcurrentDictionary<int, int>();
public ConcurrentDictionary<string, WorkItemField> SourceFields { get; set; } = new ConcurrentDictionary<string, WorkItemField>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentDictionary<string, WorkItemField> SourceFields { get; set; } = new ConcurrentDictionary<string, WorkItemField>(StringComparer.OrdinalIgnoreCase);
public ConcurrentDictionary<string, WorkItemField> TargetFields { get; set; } = new ConcurrentDictionary<string, WorkItemField>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentDictionary<string, WorkItemField> TargetFields { get; set; } = new ConcurrentDictionary<string, WorkItemField>(StringComparer.OrdinalIgnoreCase);
public ConcurrentDictionary<string, ISet<string>> SourceTypesAndFields { get; } = new ConcurrentDictionary<string, ISet<string>>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentDictionary<string, ISet<string>> SourceTypesAndFields { get; } = new ConcurrentDictionary<string, ISet<string>>(StringComparer.OrdinalIgnoreCase);
public ConcurrentDictionary<string, ISet<string>> TargetTypesAndFields { get; } = new ConcurrentDictionary<string, ISet<string>>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentDictionary<string, ISet<string>> TargetTypesAndFields { get; } = new ConcurrentDictionary<string, ISet<string>>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> ValidatedTypes { get; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> ValidatedTypes { get; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> ValidatedFields { get; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> ValidatedFields { get; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ISet<string> IdentityFields { get; set; }
public ConcurrentSet<string> SkippedTypes { get; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> SkippedTypes { get; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> SkippedFields { get; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> SkippedFields { get; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ISet<string> TargetAreaPaths { get; set; } = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ISet<string> TargetAreaPaths { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
public ISet<string> TargetIterationPaths { get; set; } = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ISet<string> TargetIterationPaths { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> ValidatedAreaPaths { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> ValidatedAreaPaths { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> SkippedAreaPaths { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> SkippedAreaPaths { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> ValidatedIterationPaths { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> ValidatedIterationPaths { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> SkippedIterationPaths { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> SkippedIterationPaths { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<string> ValidatedWorkItemLinkRelationTypes { get; set; } = new ConcurrentSet<string>(StringComparer.CurrentCultureIgnoreCase);
public ConcurrentSet<string> ValidatedWorkItemLinkRelationTypes { get; set; } = new ConcurrentSet<string>(StringComparer.OrdinalIgnoreCase);
public ConcurrentSet<int> SkippedWorkItems { get; } = new ConcurrentSet<int>();

Просмотреть файл

@ -28,7 +28,7 @@ namespace Common.Validation
{
// We need all fields to validate the field types
var sourceFields = (await WorkItemTrackingHelpers.GetFields(context.SourceClient.WorkItemTrackingHttpClient)).ToDictionary(key => key.ReferenceName);
context.SourceFields = new ConcurrentDictionary<string, WorkItemField>(sourceFields, StringComparer.CurrentCultureIgnoreCase);
context.SourceFields = new ConcurrentDictionary<string, WorkItemField>(sourceFields, StringComparer.OrdinalIgnoreCase);
}
catch (Exception e)
{
@ -39,8 +39,8 @@ namespace Common.Validation
{
// We need all fields to validate the field types
var targetFields = (await WorkItemTrackingHelpers.GetFields(context.TargetClient.WorkItemTrackingHttpClient)).ToDictionary(key => key.ReferenceName);
context.TargetFields = new ConcurrentDictionary<string, WorkItemField>(targetFields, StringComparer.CurrentCultureIgnoreCase);
context.IdentityFields = new HashSet<string>(targetFields.Where(f => f.Value.IsIdentity).Select(f => f.Key), StringComparer.CurrentCultureIgnoreCase);
context.TargetFields = new ConcurrentDictionary<string, WorkItemField>(targetFields, StringComparer.OrdinalIgnoreCase);
context.IdentityFields = new HashSet<string>(targetFields.Where(f => f.Value.IsIdentity).Select(f => f.Key), StringComparer.OrdinalIgnoreCase);
}
catch (Exception e)
{
@ -55,7 +55,7 @@ namespace Common.Validation
var workItemTypes = await WorkItemTrackingHelpers.GetWorkItemTypes(context.SourceClient.WorkItemTrackingHttpClient, context.Config.SourceConnection.Project);
foreach (var workItemType in workItemTypes)
{
context.SourceTypesAndFields[workItemType.Name] = new HashSet<string>(workItemType.Fields.Select(f => f.ReferenceName), StringComparer.CurrentCultureIgnoreCase);
context.SourceTypesAndFields[workItemType.Name] = new HashSet<string>(workItemType.Fields.Select(f => f.ReferenceName), StringComparer.OrdinalIgnoreCase);
}
}
catch (Exception e)
@ -68,7 +68,7 @@ namespace Common.Validation
var workItemTypes = await WorkItemTrackingHelpers.GetWorkItemTypes(context.TargetClient.WorkItemTrackingHttpClient, context.Config.TargetConnection.Project);
foreach (var workItemType in workItemTypes)
{
context.TargetTypesAndFields[workItemType.Name] = new HashSet<string>(workItemType.Fields.Select(f => f.ReferenceName), StringComparer.CurrentCultureIgnoreCase);
context.TargetTypesAndFields[workItemType.Name] = new HashSet<string>(workItemType.Fields.Select(f => f.ReferenceName), StringComparer.OrdinalIgnoreCase);
}
}
catch (Exception e)

Просмотреть файл

@ -42,8 +42,8 @@ namespace UnitTests.Validation
{
bool expected = true;
ISet<string> sourceFields = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase) { "System.Id", "System.AREAPATH" };
ISet<string> targetFields = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase) { "System.id", "System.areapath" };
ISet<string> sourceFields = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "System.Id", "System.AREAPATH" };
ISet<string> targetFields = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "System.id", "System.areapath" };
IValidationContext context = new ValidationContext();
context.SourceFields.TryAdd("System.Id", new WorkItemField { ReferenceName = "System.Id", Type = FieldType.Integer });