Skip to content

Commit

Permalink
Fixing issue #360 (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarqueWarrior authored Oct 15, 2020
1 parent 4ce0cbd commit 7daec7c
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 23 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Changed Get-VSTeamProject to return all projects by default instead of just the
$Global:PSDefaultParameterValues["*-vsteam*:top"] = 500
```

Fixed issue #360 but updating the way DateTimes are tested.

## 7.1.1

Fixed bug in Test-VSTeamYamlPipeline by adding a Pipelines version value.
Expand Down
2 changes: 1 addition & 1 deletion Tests/library/CommonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void MoveProperties_StringToDateTime()
Common.MoveProperties(target, source);

// Assert
Assert.AreEqual("8/27/2020 10:37:32 AM", target.CreatedOn.ToUniversalTime().ToString());
Assert.AreEqual("8/27/2020 10:37:32 am", target.CreatedOn.ToUniversalTime().ToString("M/d/yyyy h:mm:ss tt").ToLower());
}
}
}
10 changes: 5 additions & 5 deletions Tests/library/Provider/BuildDefinitionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void BuildDefinition_Constructor_2017_Git()
Assert.AreEqual("projectCollection", actual.JobAuthorizationScope, "JobAuthorizationScope");
Assert.AreEqual("$(date:yyyyMMdd)$(rev:.r)", actual.BuildNumberFormat, "BuildNumberFormat");

Assert.AreEqual("8/23/2020 3:12:41 PM", actual.CreatedOn.ToString(), "CreatedOn");
Assert.AreEqual("8/23/2020 3:12:41 pm", actual.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn");

Assert.IsNotNull(actual.Options, "Options");
Assert.AreEqual(4, actual.Options.Count, "Options.Count");
Expand Down Expand Up @@ -103,7 +103,7 @@ public void BuildDefinition_Constructor_2017_Tfvc()
Assert.IsNull(actual.GitRepository, "GitRepository");
Assert.IsNotNull(actual.RetentionRules, "RetentionRules");

Assert.AreEqual("8/23/2020 10:30:31 PM", actual.CreatedOn.ToString(), "CreatedOn");
Assert.AreEqual("8/23/2020 10:30:31 pm", actual.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn");

Assert.AreEqual(5, actual.JobCancelTimeoutInMinutes, "JobCancelTimeoutInMinutes");
Assert.AreEqual("projectCollection", actual.JobAuthorizationScope, "JobAuthorizationScope");
Expand Down Expand Up @@ -145,7 +145,7 @@ public void BuildDefinition_Constructor_2018()
Assert.IsNotNull(actual.GitRepository, "GitRepository");
Assert.IsNotNull(actual.RetentionRules, "RetentionRules");

Assert.AreEqual("8/23/2020 3:16:22 PM", actual.CreatedOn.ToString(), "CreatedOn");
Assert.AreEqual("8/23/2020 3:16:22 pm", actual.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn");

Assert.AreEqual(5, actual.JobCancelTimeoutInMinutes, "JobCancelTimeoutInMinutes");
Assert.AreEqual("projectCollection", actual.JobAuthorizationScope, "JobAuthorizationScope");
Expand Down Expand Up @@ -205,7 +205,7 @@ public void BuildDefinition_Constructor_AzD_Classic()

Assert.IsNull(actual.Demands, "Demands");

Assert.AreEqual("9/16/2019 2:34:16 AM", actual.CreatedOn.ToString(), "CreatedOn");
Assert.AreEqual("9/16/2019 2:34:16 am", actual.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn");

// Not on this build def
Assert.AreEqual(null, actual.BuildNumberFormat, "BuildNumberFormat");
Expand Down Expand Up @@ -266,7 +266,7 @@ public void BuildDefinition_Constructor_AzD_YAML()

Assert.IsNull(actual.Demands, "Demands");

Assert.AreEqual("9/25/2019 8:55:54 PM", actual.CreatedOn.ToString(), "CreatedOn");
Assert.AreEqual("9/25/2019 8:55:54 pm", actual.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn");

// Not on this build def
Assert.AreEqual(0, actual.JobCancelTimeoutInMinutes, "JobCancelTimeoutInMinutes");
Expand Down
4 changes: 2 additions & 2 deletions Tests/library/Provider/BuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void Build_Constructor()
Assert.AreEqual("PTracker-CI", actual.DefinitionName, "DefinitionName");
Assert.AreEqual("Donovan Brown", actual.RequestedByUser, "RequestedByUser");
Assert.AreEqual("Donovan Brown", actual.RequestedForUser, "RequestedForUser");
Assert.AreEqual("11/14/2019 12:49:37 AM", actual.StartTime.ToString(), "startTime");
Assert.AreEqual("11/14/2019 12:49:37 am", actual.StartTime?.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "startTime");
Assert.AreEqual("Microsoft.VisualStudio.Services.ReleaseManagement", actual.LastChangedByUser, "LastChangedByUser");

Assert.IsNotNull(actual.TriggerInfo, "TriggerInfo");
Expand Down Expand Up @@ -84,7 +84,7 @@ public void Build_Constructor_ById()
Assert.AreEqual("Team Module-CI (1)", actual.DefinitionName, "DefinitionName");
Assert.AreEqual("Donovan Brown", actual.RequestedByUser, "RequestedByUser");
Assert.AreEqual("Donovan Brown", actual.RequestedForUser, "RequestedForUser");
Assert.AreEqual("9/23/2020 3:44:45 PM", actual.StartTime.ToString(), "startTime");
Assert.AreEqual("9/23/2020 3:44:45 pm", actual.StartTime?.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "startTime");
Assert.AreEqual("Microsoft.VisualStudio.Services.TFS", actual.LastChangedByUser, "LastChangedByUser");

Assert.IsNotNull(actual.TriggerInfo, "TriggerInfo");
Expand Down
5 changes: 3 additions & 2 deletions Tests/library/Provider/ExtensionTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics.CodeAnalysis;

namespace vsteam_lib.Test.Provider
Expand All @@ -25,8 +26,8 @@ public void Extension_Constructor()
Assert.IsNotNull(actual.InstallState, "InstallState");
Assert.AreEqual("none", actual.InstallState.Flags, "InstallState.Flags");
Assert.IsNotNull(actual.InstallState.InternalObject, "InstallState.InternalObject");
Assert.AreEqual("8/10/2020 8:31:07 PM", actual.InstallState.LastUpdated.ToString(), "InstallState.LastUpdated");
Assert.AreEqual("Flags: none, Last Updated: 8/10/2020 8:31:07 PM", actual.InstallState.ToString(), "InstallState.ToString()");
Assert.IsTrue(actual.InstallState.ToString().StartsWith("Flags: none, Last Updated: "), "InstallState.ToString()");
Assert.AreEqual("8/10/2020 8:31:07 pm", actual.InstallState.LastUpdated.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "InstallState.LastUpdated");
}
}
}
2 changes: 1 addition & 1 deletion Tests/library/Provider/GitCommitRefTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void GitCommitRefTests_Constructor()
Assert.IsNotNull(target.Committer, "Committer");
Assert.AreEqual("Donovan Brown", target.Committer.Name, "Committer.Name");
Assert.AreEqual("[email protected]", target.Committer.Email, "Committer.Email");
Assert.AreEqual("8/8/2019 8:58:58 PM", target.Committer.Date.ToString(), "Committer.Date");
Assert.AreEqual("8/8/2019 8:58:58 pm", target.Committer.Date.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "Committer.Date");
}
}
}
8 changes: 4 additions & 4 deletions Tests/library/Provider/JobRequestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public void JobRequest_Constructor_Completed()
Assert.AreEqual("PTracker-CD", target.Pipeline, "Pipeline");
Assert.AreEqual("------", target.DisplayMode, "DisplayMode");
Assert.AreEqual(TimeSpan.Parse("00:10:58"), target.Duration, "Duration");
Assert.AreEqual("11/14/2019 12:56:12 AM", target.QueueTime.ToString(), "QueueTime");
Assert.AreEqual("11/14/2019 12:56:15 AM", target.StartTime.ToString(), "StartTime");
Assert.AreEqual("11/14/2019 1:07:13 AM", target.FinishTime.ToString(), "FinishTime");
Assert.AreEqual("11/14/2019 12:56:12 AM", target.AssignedTime.ToString(), "AssignedTime");
Assert.AreEqual("11/14/2019 12:56:12 am", target.QueueTime.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "QueueTime");
Assert.AreEqual("11/14/2019 12:56:15 am", target.StartTime?.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "StartTime");
Assert.AreEqual("11/14/2019 1:07:13 am", target.FinishTime?.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "FinishTime");
Assert.AreEqual("11/14/2019 12:56:12 am", target.AssignedTime?.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "AssignedTime");
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion Tests/library/Provider/PackageVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void PackageVersion_Constructor()
Assert.AreEqual("@DonovanBrown", actual.Author, "author");
Assert.AreEqual(expectedDesc, actual.Description, "Description");
Assert.AreEqual("998abe34-23de-0000-9668b73891e2dada", actual.Id, "Id");
Assert.AreEqual("9/7/2018 1:33:39 PM", actual.PublishDate.ToString(), "PublishDate");
Assert.AreEqual("9/7/2018 1:33:39 pm", actual.PublishDate.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "PublishDate");
}
}
}
8 changes: 4 additions & 4 deletions Tests/library/Provider/ReleaseDefinitionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public void ReleaseDefinition_Constructor()
Assert.AreEqual("", actual.ReleaseNameFormat, "ReleaseNameFormat");
Assert.AreEqual("Chuck Reinhart", actual.CreatedByUser, "CreatedByUser");
Assert.AreEqual("ReleaseDefinition", actual.ResourceType, "ResourceType");
Assert.AreEqual("12/11/2018 4:48:42 AM", actual.CreatedOn.ToString(), "CreatedOn");
Assert.AreEqual("12/11/2018 4:48:42 AM", actual.ModifiedOn.ToString(), "ModifiedOn");
Assert.AreEqual("12/11/2018 4:48:42 am", actual.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn");
Assert.AreEqual("12/11/2018 4:48:42 am", actual.ModifiedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "ModifiedOn");
Assert.AreEqual("https://vsrm.dev.azure.com/fabrikam/00000000-0000-0000-0000-000000000000/_apis/Release/definitions/40", actual.Url, "Url");
}

Expand Down Expand Up @@ -81,9 +81,9 @@ public void ReleaseDefinition_Constructor_NoEnvs()
Assert.AreEqual("PTracker-CD", actual.Name, "Name");
Assert.AreEqual(null, actual.Description, "Description");
Assert.AreEqual("Donovan Brown", actual.CreatedByUser, "CreatedByUser");
Assert.AreEqual("3/24/2019 4:46:08 PM", actual.CreatedOn.ToString(), "CreatedOn");
Assert.AreEqual("Release-$(rev:r)", actual.ReleaseNameFormat, "ReleaseNameFormat");
Assert.AreEqual("9/16/2019 2:32:37 PM", actual.ModifiedOn.ToString(), "ModifiedOn");
Assert.AreEqual("3/24/2019 4:46:08 pm", actual.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn");
Assert.AreEqual("9/16/2019 2:32:37 pm", actual.ModifiedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "ModifiedOn");
Assert.AreEqual("https://vsrm.dev.azure.com/Test/00000000-0000-0000-0000-000000000000/_apis/Release/definitions/2", actual.Url, "Url");
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/library/Provider/ReleaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void Release_Constructor()

Assert.AreEqual("[email protected]", target.ModifiedBy.UniqueName, "ModifiedBy.UniqueName");
Assert.AreEqual("Donovan Brown", target.CreatedBy.DisplayName, "CreatedBy.DisplayName");
Assert.AreEqual("11/14/2019 12:56:09 AM", target.CreatedOn.ToString(), "CreatedOn.ToString()");
Assert.AreEqual("11/14/2019 12:56:09 am", target.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn.ToString()");

Assert.AreEqual("Donovan Brown", target.CreatedByUser, "CreatedByUser");
Assert.AreEqual("Donovan Brown", target.ModifiedByUser, "ModifiedByUser");
Expand Down Expand Up @@ -66,7 +66,7 @@ public void Release_Constructor_Expand_Environments()

Assert.AreEqual("[email protected]", target.ModifiedBy.UniqueName, "ModifiedBy.UniqueName");
Assert.AreEqual("Donovan Brown", target.CreatedBy.DisplayName, "CreatedBy.DisplayName");
Assert.AreEqual("7/13/2019 3:49:31 PM", target.CreatedOn.ToString(), "CreatedOn.ToString()");
Assert.AreEqual("7/13/2019 3:49:31 pm", target.CreatedOn.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "CreatedOn.ToString()");
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion Tests/library/Provider/UserEntitlementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void UserEntitlementTests_Constructor()
Assert.AreEqual("Math lastName", target.DisplayName, "DisplayName");
Assert.AreEqual("[email protected]", target.UniqueName, "UniqueName");
Assert.AreEqual("Early Adopter", target.AccessLevelName, "AccessLevelName");
Assert.AreEqual("9/9/2020 6:43:29 AM", target.LastAccessedDate.ToString(), "LastAccessedDate");
Assert.AreEqual("9/9/2020 6:43:29 am", target.LastAccessedDate.ToString("M/d/yyyy h:mm:ss tt").ToLower(), "LastAccessedDate");
}

[TestMethod]
Expand Down

0 comments on commit 7daec7c

Please sign in to comment.