diff --git a/src/WorkItemMigrator/WorkItemImport/WitClient/WitClientUtils.cs b/src/WorkItemMigrator/WorkItemImport/WitClient/WitClientUtils.cs index ace9317a..f467c6c5 100644 --- a/src/WorkItemMigrator/WorkItemImport/WitClient/WitClientUtils.cs +++ b/src/WorkItemMigrator/WorkItemImport/WitClient/WitClientUtils.cs @@ -668,11 +668,12 @@ private void CorrectClosedByAndClosedDate(WiRevision rev, WorkItem wi) wiState.Equals("Done", StringComparison.InvariantCultureIgnoreCase) || wiState.Equals("Closed", StringComparison.InvariantCultureIgnoreCase) ) - && revState.Equals("New", StringComparison.InvariantCultureIgnoreCase) + && !(revState.Equals("Done", StringComparison.InvariantCultureIgnoreCase) + || revState.Equals("Closed", StringComparison.InvariantCultureIgnoreCase)) ) { - rev.Fields.Add(new WiField() { ReferenceName = WiFieldReference.ClosedDate, Value = null }); - rev.Fields.Add(new WiField() { ReferenceName = WiFieldReference.ClosedBy, Value = null }); + rev.Fields.Add(new WiField() { ReferenceName = WiFieldReference.ClosedDate, Value = "" }); + rev.Fields.Add(new WiField() { ReferenceName = WiFieldReference.ClosedBy, Value = "" }); } if ( diff --git a/src/WorkItemMigrator/tests/Migration.Wi-Import.Tests/WitClient/WitClientUtilsTests.cs b/src/WorkItemMigrator/tests/Migration.Wi-Import.Tests/WitClient/WitClientUtilsTests.cs index 81e9fded..d316f5ff 100644 --- a/src/WorkItemMigrator/tests/Migration.Wi-Import.Tests/WitClient/WitClientUtilsTests.cs +++ b/src/WorkItemMigrator/tests/Migration.Wi-Import.Tests/WitClient/WitClientUtilsTests.cs @@ -335,8 +335,8 @@ public void When_calling_ensure_fields_on_state_change_with_subsequent_revision_ Assert.Multiple(() => { Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.State), Is.EqualTo("New")); - Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedDate), Is.EqualTo(null)); - Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedBy), Is.EqualTo(null)); + Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedDate), Is.EqualTo("")); + Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedBy), Is.EqualTo("")); Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ActivatedDate), Is.EqualTo(null)); Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ActivatedBy), Is.EqualTo(null)); }); @@ -365,8 +365,8 @@ public void When_calling_ensure_fields_on_a_closed_user_Story_with_Then_closed_d Assert.Multiple(() => { Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.State), Is.EqualTo("New")); - Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedDate), Is.EqualTo(null)); - Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedBy), Is.EqualTo(null)); + Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedDate), Is.EqualTo("")); + Assert.That(rev.Fields.GetFieldValueOrDefault(WiFieldReference.ClosedBy), Is.EqualTo("")); }); }