diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml new file mode 100644 index 0000000..ea2f9f8 --- /dev/null +++ b/.github/workflows/dotnetcore.yml @@ -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 + diff --git a/Common/BaseContext.cs b/Common/BaseContext.cs index 8a0eb9c..111608f 100644 --- a/Common/BaseContext.cs +++ b/Common/BaseContext.cs @@ -34,6 +34,6 @@ namespace Common public ConcurrentDictionary SourceToTargetIds { get; set; } = new ConcurrentDictionary(); - public ConcurrentSet RemoteLinkRelationTypes { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet RemoteLinkRelationTypes { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); } } diff --git a/Common/ClientHelpers.cs b/Common/ClientHelpers.cs index 7b9ff88..889efc6 100644 --- a/Common/ClientHelpers.cs +++ b/Common/ClientHelpers.cs @@ -79,7 +79,7 @@ namespace Common public static IEnumerable GetInstances() { - 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) diff --git a/Common/Migration/Contexts/MigrationContext.cs b/Common/Migration/Contexts/MigrationContext.cs index 1cbf2fd..3daa915 100644 --- a/Common/Migration/Contexts/MigrationContext.cs +++ b/Common/Migration/Contexts/MigrationContext.cs @@ -16,11 +16,11 @@ namespace Common.Migration public ConcurrentDictionary> WorkItemTypes { get; set; } - public ConcurrentDictionary SourceFields { get; set; } = new ConcurrentDictionary(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentDictionary SourceFields { get; set; } = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); public ConcurrentDictionary SourceToTags { get; set; } = new ConcurrentDictionary(); - public ISet HtmlFieldReferenceNames { get; set; } = new HashSet(StringComparer.CurrentCultureIgnoreCase); + public ISet HtmlFieldReferenceNames { get; set; } = new HashSet(StringComparer.OrdinalIgnoreCase); public ISet TargetAreaPaths { get; set; } @@ -28,9 +28,9 @@ namespace Common.Migration public ISet IdentityFields { get; set; } - public ConcurrentSet ValidatedIdentities { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet ValidatedIdentities { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet InvalidIdentities { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet InvalidIdentities { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); public IList UnsupportedFields => unsupportedFields; diff --git a/Common/Migration/Phase1/PreProcessors/IdentityPreProcessor.cs b/Common/Migration/Phase1/PreProcessors/IdentityPreProcessor.cs index 8339cfb..03582b6 100644 --- a/Common/Migration/Phase1/PreProcessors/IdentityPreProcessor.cs +++ b/Common/Migration/Phase1/PreProcessors/IdentityPreProcessor.cs @@ -44,7 +44,7 @@ namespace Common.Migration { object identityObject = null; string identityValue = null; - HashSet identitiesToProcess = new HashSet(StringComparer.CurrentCultureIgnoreCase); + HashSet identitiesToProcess = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var sourceWorkItem in batchContext.SourceWorkItems) { diff --git a/Common/Migration/Phase1/PreProcessors/InlineImagesPreProcessor.cs b/Common/Migration/Phase1/PreProcessors/InlineImagesPreProcessor.cs index 8edb0fb..7a941d8 100644 --- a/Common/Migration/Phase1/PreProcessors/InlineImagesPreProcessor.cs +++ b/Common/Migration/Phase1/PreProcessors/InlineImagesPreProcessor.cs @@ -36,7 +36,7 @@ namespace Common.Migration private ISet GetHtmlFieldReferenceNames(IList sourceWorkItemFields) { IEnumerable htmlFields = sourceWorkItemFields.Where(a => a.Type == FieldType.Html); - ISet htmlFieldReferenceNames = new HashSet(StringComparer.CurrentCultureIgnoreCase); + ISet htmlFieldReferenceNames = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var field in htmlFields) { htmlFieldReferenceNames.Add(field.ReferenceName); diff --git a/Common/Validation/ValidationContext.cs b/Common/Validation/ValidationContext.cs index 01db42a..0b7a0c8 100644 --- a/Common/Validation/ValidationContext.cs +++ b/Common/Validation/ValidationContext.cs @@ -18,41 +18,41 @@ namespace Common.Validation //Mapping of targetId of a work item to attribute id of the hyperlink public ConcurrentDictionary TargetIdToSourceHyperlinkAttributeId { get; set; } = new ConcurrentDictionary(); - public ISet RequestedFields { get; } = new HashSet(StringComparer.CurrentCultureIgnoreCase); + public ISet RequestedFields { get; } = new HashSet(StringComparer.OrdinalIgnoreCase); public ConcurrentDictionary SourceWorkItemRevision { get; set; } = new ConcurrentDictionary(); - public ConcurrentDictionary SourceFields { get; set; } = new ConcurrentDictionary(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentDictionary SourceFields { get; set; } = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); - public ConcurrentDictionary TargetFields { get; set; } = new ConcurrentDictionary(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentDictionary TargetFields { get; set; } = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); - public ConcurrentDictionary> SourceTypesAndFields { get; } = new ConcurrentDictionary>(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentDictionary> SourceTypesAndFields { get; } = new ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase); - public ConcurrentDictionary> TargetTypesAndFields { get; } = new ConcurrentDictionary>(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentDictionary> TargetTypesAndFields { get; } = new ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet ValidatedTypes { get; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet ValidatedTypes { get; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet ValidatedFields { get; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet ValidatedFields { get; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); public ISet IdentityFields { get; set; } - public ConcurrentSet SkippedTypes { get; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet SkippedTypes { get; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet SkippedFields { get; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet SkippedFields { get; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ISet TargetAreaPaths { get; set; } = new HashSet(StringComparer.CurrentCultureIgnoreCase); + public ISet TargetAreaPaths { get; set; } = new HashSet(StringComparer.OrdinalIgnoreCase); - public ISet TargetIterationPaths { get; set; } = new HashSet(StringComparer.CurrentCultureIgnoreCase); + public ISet TargetIterationPaths { get; set; } = new HashSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet ValidatedAreaPaths { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet ValidatedAreaPaths { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet SkippedAreaPaths { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet SkippedAreaPaths { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet ValidatedIterationPaths { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet ValidatedIterationPaths { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet SkippedIterationPaths { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet SkippedIterationPaths { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); - public ConcurrentSet ValidatedWorkItemLinkRelationTypes { get; set; } = new ConcurrentSet(StringComparer.CurrentCultureIgnoreCase); + public ConcurrentSet ValidatedWorkItemLinkRelationTypes { get; set; } = new ConcurrentSet(StringComparer.OrdinalIgnoreCase); public ConcurrentSet SkippedWorkItems { get; } = new ConcurrentSet(); diff --git a/Common/Validation/WorkItem/ValidateWorkItemTypes.cs b/Common/Validation/WorkItem/ValidateWorkItemTypes.cs index ce7df2b..b114071 100644 --- a/Common/Validation/WorkItem/ValidateWorkItemTypes.cs +++ b/Common/Validation/WorkItem/ValidateWorkItemTypes.cs @@ -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(sourceFields, StringComparer.CurrentCultureIgnoreCase); + context.SourceFields = new ConcurrentDictionary(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(targetFields, StringComparer.CurrentCultureIgnoreCase); - context.IdentityFields = new HashSet(targetFields.Where(f => f.Value.IsIdentity).Select(f => f.Key), StringComparer.CurrentCultureIgnoreCase); + context.TargetFields = new ConcurrentDictionary(targetFields, StringComparer.OrdinalIgnoreCase); + context.IdentityFields = new HashSet(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(workItemType.Fields.Select(f => f.ReferenceName), StringComparer.CurrentCultureIgnoreCase); + context.SourceTypesAndFields[workItemType.Name] = new HashSet(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(workItemType.Fields.Select(f => f.ReferenceName), StringComparer.CurrentCultureIgnoreCase); + context.TargetTypesAndFields[workItemType.Name] = new HashSet(workItemType.Fields.Select(f => f.ReferenceName), StringComparer.OrdinalIgnoreCase); } } catch (Exception e) diff --git a/UnitTests/Validation/ValidateWorkitemTypesTests.cs b/UnitTests/Validation/ValidateWorkitemTypesTests.cs index fed5639..3e5083d 100644 --- a/UnitTests/Validation/ValidateWorkitemTypesTests.cs +++ b/UnitTests/Validation/ValidateWorkitemTypesTests.cs @@ -42,8 +42,8 @@ namespace UnitTests.Validation { bool expected = true; - ISet sourceFields = new HashSet(StringComparer.CurrentCultureIgnoreCase) { "System.Id", "System.AREAPATH" }; - ISet targetFields = new HashSet(StringComparer.CurrentCultureIgnoreCase) { "System.id", "System.areapath" }; + ISet sourceFields = new HashSet(StringComparer.OrdinalIgnoreCase) { "System.Id", "System.AREAPATH" }; + ISet targetFields = new HashSet(StringComparer.OrdinalIgnoreCase) { "System.id", "System.areapath" }; IValidationContext context = new ValidationContext(); context.SourceFields.TryAdd("System.Id", new WorkItemField { ReferenceName = "System.Id", Type = FieldType.Integer });