From 8da1fa23fc6f7c1b55347258889df1bae26c474f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 1 Mar 2019 04:36:44 +0000 Subject: [PATCH 1/9] Bump Microsoft.NET.Test.Sdk from 15.9.0 to 16.0.0 in /src Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 15.9.0 to 16.0.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/commits) Signed-off-by: dependabot[bot] --- src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj b/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj index f4da739e..cc06f71d 100644 --- a/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj +++ b/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj @@ -14,7 +14,7 @@ - + From c6b711fb8d19606d67b3706807fb483b16273c0d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 5 Mar 2019 04:27:52 +0000 Subject: [PATCH 2/9] Bump Microsoft.NET.Test.Sdk from 16.0.0 to 16.0.1 in /src Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.0.0 to 16.0.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/commits) Signed-off-by: dependabot[bot] --- src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj b/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj index cc06f71d..75c78ef3 100644 --- a/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj +++ b/src/Cake.Tfs.Tests/Cake.Tfs.Tests.csproj @@ -14,7 +14,7 @@ - + From 906bbba68fef4e7feb25dd741cb533e153ea6572 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 15 Mar 2019 19:22:07 +0000 Subject: [PATCH 3/9] Bump Costura.Fody from 3.3.2 to 3.3.3 in /src Bumps [Costura.Fody](https://github.com/Fody/Costura) from 3.3.2 to 3.3.3. - [Release notes](https://github.com/Fody/Costura/releases) - [Commits](https://github.com/Fody/Costura/commits) Signed-off-by: dependabot[bot] --- src/Cake.Tfs/Cake.Tfs.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Tfs/Cake.Tfs.csproj b/src/Cake.Tfs/Cake.Tfs.csproj index 51311a7d..3a208f6d 100644 --- a/src/Cake.Tfs/Cake.Tfs.csproj +++ b/src/Cake.Tfs/Cake.Tfs.csproj @@ -23,7 +23,7 @@ - + From 5ad59cee50af3516dcae82a455e7dcb098ab8695 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 27 Mar 2019 04:34:52 +0000 Subject: [PATCH 4/9] Bump Microsoft.CodeAnalysis.FxCopAnalyzers from 2.6.3 to 2.9.0 in /src Bumps [Microsoft.CodeAnalysis.FxCopAnalyzers](https://github.com/dotnet/roslyn-analyzers) from 2.6.3 to 2.9.0. - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Commits](https://github.com/dotnet/roslyn-analyzers/commits) Signed-off-by: dependabot[bot] --- src/Cake.Tfs/Cake.Tfs.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Tfs/Cake.Tfs.csproj b/src/Cake.Tfs/Cake.Tfs.csproj index 3a208f6d..7eb8faf3 100644 --- a/src/Cake.Tfs/Cake.Tfs.csproj +++ b/src/Cake.Tfs/Cake.Tfs.csproj @@ -24,7 +24,7 @@ - + From 7f6cad98c166e8f756f4f3f536a492975a92de8e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 29 Mar 2019 04:19:18 +0000 Subject: [PATCH 5/9] Bump Microsoft.CodeAnalysis.FxCopAnalyzers from 2.9.0 to 2.9.1 in /src Bumps [Microsoft.CodeAnalysis.FxCopAnalyzers](https://github.com/dotnet/roslyn-analyzers) from 2.9.0 to 2.9.1. - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Commits](https://github.com/dotnet/roslyn-analyzers/compare/v2.9.0...v2.9.1) Signed-off-by: dependabot[bot] --- src/Cake.Tfs/Cake.Tfs.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Tfs/Cake.Tfs.csproj b/src/Cake.Tfs/Cake.Tfs.csproj index 7eb8faf3..eefec70a 100644 --- a/src/Cake.Tfs/Cake.Tfs.csproj +++ b/src/Cake.Tfs/Cake.Tfs.csproj @@ -24,7 +24,7 @@ - + From 49f76a1c9a5f109d6a541ab7a23fe4cf15b7e485 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 31 Mar 2019 12:18:53 +0200 Subject: [PATCH 6/9] (GH-84) Return default value in case property collection is not initialized --- .../TfsPullRequestCommentThreadTests.cs | 57 ++++++++++++++++++- .../TfsPullRequestCommentThread.cs | 5 +- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/Cake.Tfs.Tests/PullRequest/CommentThread/TfsPullRequestCommentThreadTests.cs b/src/Cake.Tfs.Tests/PullRequest/CommentThread/TfsPullRequestCommentThreadTests.cs index f9e07fdd..85496346 100644 --- a/src/Cake.Tfs.Tests/PullRequest/CommentThread/TfsPullRequestCommentThreadTests.cs +++ b/src/Cake.Tfs.Tests/PullRequest/CommentThread/TfsPullRequestCommentThreadTests.cs @@ -259,16 +259,67 @@ public void Should_Throw_If_Property_Name_Is_Empty() } [Fact] - public void Should_Throw_If_Property_Collection_Is_Null() + public void Should_Return_Default_Value_If_Property_Collection_Is_Null_For_String_Value() { // Given var tfsThread = new TfsPullRequestCommentThread(); // When - var result = Record.Exception(() => tfsThread.GetValue("key")); + var result = tfsThread.GetValue("key"); // Then - result.IsInvalidOperationException(); + result.ShouldBe(default(string)); + } + + [Fact] + public void Should_Return_Default_Value_If_Property_Collection_Is_Null_For_Integer_Value() + { + // Given + var tfsThread = new TfsPullRequestCommentThread(); + + // When + var result = tfsThread.GetValue("key"); + + // Then + result.ShouldBe(default(int)); + } + + [Fact] + public void Should_Return_Default_Value_If_Property_Does_Not_Exist_For_String_Value() + { + // Given + var tfsThread = new TfsPullRequestCommentThread( + new GitPullRequestCommentThread + { + Id = 42, + Status = CommentThreadStatus.Active, + Properties = new PropertiesCollection() + }); + + // When + var result = tfsThread.GetValue("key"); + + // Then + result.ShouldBe(default(string)); + } + + [Fact] + public void Should_Return_Default_Value_If_Property_Does_Not_Exist_For_Int_Value() + { + // Given + var tfsThread = new TfsPullRequestCommentThread( + new GitPullRequestCommentThread + { + Id = 42, + Status = CommentThreadStatus.Active, + Properties = new PropertiesCollection() + }); + + // When + var result = tfsThread.GetValue("key"); + + // Then + result.ShouldBe(default(int)); } [Fact] diff --git a/src/Cake.Tfs/PullRequest/CommentThread/TfsPullRequestCommentThread.cs b/src/Cake.Tfs/PullRequest/CommentThread/TfsPullRequestCommentThread.cs index 09fd3a0f..aa4f8547 100644 --- a/src/Cake.Tfs/PullRequest/CommentThread/TfsPullRequestCommentThread.cs +++ b/src/Cake.Tfs/PullRequest/CommentThread/TfsPullRequestCommentThread.cs @@ -119,14 +119,14 @@ public IDictionary Properties /// /// Type of the value. /// Name of the property. - /// Value of the property. + /// Value of the property or default value for if property does not exist. public T GetValue(string propertyName) { propertyName.NotNullOrWhiteSpace(nameof(propertyName)); if (this.thread.Properties == null) { - throw new InvalidOperationException("Properties collection is not created."); + return default(T); } return this.thread.Properties.GetValue(propertyName, default(T)); @@ -138,6 +138,7 @@ public T GetValue(string propertyName) /// Type of the value. /// Name of the property. /// Value to set. + /// If properties collection is not created. public void SetValue(string propertyName, T value) { propertyName.NotNullOrWhiteSpace(nameof(propertyName)); From 297e87d7c04307f82670153cced8b49e851d3a51 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 31 Mar 2019 12:34:28 +0200 Subject: [PATCH 7/9] (GH-86) Import namespaces on method level --- src/Cake.Tfs/TfsAliases.Authentication.cs | 6 +++++- src/Cake.Tfs/TfsAliases.PullRequest.cs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Cake.Tfs/TfsAliases.Authentication.cs b/src/Cake.Tfs/TfsAliases.Authentication.cs index 75c232d2..4692a07d 100644 --- a/src/Cake.Tfs/TfsAliases.Authentication.cs +++ b/src/Cake.Tfs/TfsAliases.Authentication.cs @@ -7,7 +7,6 @@ /// /// Contains functionality related to authenticating to Team Foundation Server or Azure DevOps. /// - [CakeNamespaceImport("Cake.Tfs.Authentication")] public static partial class TfsAliases { /// @@ -18,6 +17,7 @@ public static partial class TfsAliases /// Credentials for integrated / NTLM authentication [CakeMethodAlias] [CakeAliasCategory("Authentication")] + [CakeNamespaceImport("Cake.Tfs.Authentication")] public static ITfsCredentials TfsAuthenticationNtlm( this ICakeContext context) { @@ -37,6 +37,7 @@ public static ITfsCredentials TfsAuthenticationNtlm( /// Credentials for basic authentication. [CakeMethodAlias] [CakeAliasCategory("Authentication")] + [CakeNamespaceImport("Cake.Tfs.Authentication")] public static ITfsCredentials TfsAuthenticationBasic( this ICakeContext context, string userName, @@ -58,6 +59,7 @@ public static ITfsCredentials TfsAuthenticationBasic( /// Credentials for authentication with a personal access token. [CakeMethodAlias] [CakeAliasCategory("Authentication")] + [CakeNamespaceImport("Cake.Tfs.Authentication")] public static ITfsCredentials TfsAuthenticationPersonalAccessToken( this ICakeContext context, string personalAccessToken) @@ -77,6 +79,7 @@ public static ITfsCredentials TfsAuthenticationPersonalAccessToken( /// Credentials for OAuth authentication. [CakeMethodAlias] [CakeAliasCategory("Authentication")] + [CakeNamespaceImport("Cake.Tfs.Authentication")] public static ITfsCredentials TfsAuthenticationOAuth( this ICakeContext context, string accessToken) @@ -97,6 +100,7 @@ public static ITfsCredentials TfsAuthenticationOAuth( /// Credentials for authentication with an Azure Active Directory. [CakeMethodAlias] [CakeAliasCategory("Authentication")] + [CakeNamespaceImport("Cake.Tfs.Authentication")] public static ITfsCredentials TfsAuthenticationAzureActiveDirectory( this ICakeContext context, string userName, diff --git a/src/Cake.Tfs/TfsAliases.PullRequest.cs b/src/Cake.Tfs/TfsAliases.PullRequest.cs index 3acc7575..c9d2d317 100644 --- a/src/Cake.Tfs/TfsAliases.PullRequest.cs +++ b/src/Cake.Tfs/TfsAliases.PullRequest.cs @@ -8,7 +8,6 @@ /// /// Contains functionality related to Team Foundation Server or Azure DevOps pull requests. /// - [CakeNamespaceImport("Cake.Tfs.PullRequest")] public static partial class TfsAliases { /// @@ -39,6 +38,7 @@ public static partial class TfsAliases /// is set to true. [CakeMethodAlias] [CakeAliasCategory("Pull Request")] + [CakeNamespaceImport("Cake.Tfs.PullRequest")] public static TfsPullRequest TfsPullRequest( this ICakeContext context, TfsPullRequestSettings settings) @@ -80,6 +80,7 @@ public static TfsPullRequest TfsPullRequest( /// 'Allow Scripts to access OAuth token' option is not enabled on the build definition. [CakeMethodAlias] [CakeAliasCategory("Pull Request")] + [CakeNamespaceImport("Cake.Tfs.PullRequest")] public static TfsPullRequest TfsPullRequestUsingTfsBuildOAuthToken( this ICakeContext context) { @@ -117,6 +118,7 @@ public static TfsPullRequest TfsPullRequestUsingTfsBuildOAuthToken( /// is set to true. [CakeMethodAlias] [CakeAliasCategory("Pull Request")] + [CakeNamespaceImport("Cake.Tfs.PullRequest")] public static void TfsVotePullRequest( this ICakeContext context, TfsPullRequestSettings settings, @@ -163,6 +165,7 @@ public static void TfsVotePullRequest( /// is set to true. [CakeMethodAlias] [CakeAliasCategory("Pull Request")] + [CakeNamespaceImport("Cake.Tfs.PullRequest")] public static void TfsSetPullRequestStatus( this ICakeContext context, TfsPullRequestSettings settings, @@ -203,6 +206,7 @@ public static void TfsSetPullRequestStatus( /// If the target branch could not be found. [CakeMethodAlias] [CakeAliasCategory("Pull Request")] + [CakeNamespaceImport("Cake.Tfs.PullRequest")] public static TfsPullRequest TfsCreatePullRequest( this ICakeContext context, TfsCreatePullRequestSettings settings) From 343c67b3a50e186c82da7d5dbd1a3350e1443a20 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 31 Mar 2019 12:37:21 +0200 Subject: [PATCH 8/9] (GH-82) Import Cake.Tfs.PullRequest.CommentThread namespace --- src/Cake.Tfs/TfsAliases.PullRequest.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Cake.Tfs/TfsAliases.PullRequest.cs b/src/Cake.Tfs/TfsAliases.PullRequest.cs index c9d2d317..4c91e1cc 100644 --- a/src/Cake.Tfs/TfsAliases.PullRequest.cs +++ b/src/Cake.Tfs/TfsAliases.PullRequest.cs @@ -39,6 +39,7 @@ public static partial class TfsAliases [CakeMethodAlias] [CakeAliasCategory("Pull Request")] [CakeNamespaceImport("Cake.Tfs.PullRequest")] + [CakeNamespaceImport("Cake.Tfs.PullRequest.CommentThread")] public static TfsPullRequest TfsPullRequest( this ICakeContext context, TfsPullRequestSettings settings) @@ -81,6 +82,7 @@ public static TfsPullRequest TfsPullRequest( [CakeMethodAlias] [CakeAliasCategory("Pull Request")] [CakeNamespaceImport("Cake.Tfs.PullRequest")] + [CakeNamespaceImport("Cake.Tfs.PullRequest.CommentThread")] public static TfsPullRequest TfsPullRequestUsingTfsBuildOAuthToken( this ICakeContext context) { @@ -119,6 +121,7 @@ public static TfsPullRequest TfsPullRequestUsingTfsBuildOAuthToken( [CakeMethodAlias] [CakeAliasCategory("Pull Request")] [CakeNamespaceImport("Cake.Tfs.PullRequest")] + [CakeNamespaceImport("Cake.Tfs.PullRequest.CommentThread")] public static void TfsVotePullRequest( this ICakeContext context, TfsPullRequestSettings settings, @@ -166,6 +169,7 @@ public static void TfsVotePullRequest( [CakeMethodAlias] [CakeAliasCategory("Pull Request")] [CakeNamespaceImport("Cake.Tfs.PullRequest")] + [CakeNamespaceImport("Cake.Tfs.PullRequest.CommentThread")] public static void TfsSetPullRequestStatus( this ICakeContext context, TfsPullRequestSettings settings, @@ -207,6 +211,7 @@ public static void TfsSetPullRequestStatus( [CakeMethodAlias] [CakeAliasCategory("Pull Request")] [CakeNamespaceImport("Cake.Tfs.PullRequest")] + [CakeNamespaceImport("Cake.Tfs.PullRequest.CommentThread")] public static TfsPullRequest TfsCreatePullRequest( this ICakeContext context, TfsCreatePullRequestSettings settings) From 08b38d2ce53dbb1a12761da578a273f85eb24d76 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 31 Mar 2019 21:56:55 +0200 Subject: [PATCH 9/9] Update release notes link --- nuspec/nuget/Cake.Tfs.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuspec/nuget/Cake.Tfs.nuspec b/nuspec/nuget/Cake.Tfs.nuspec index 32476fa9..8f1266e4 100644 --- a/nuspec/nuget/Cake.Tfs.nuspec +++ b/nuspec/nuget/Cake.Tfs.nuspec @@ -17,7 +17,7 @@ Copyright © Pascal Berger Cake Script Team-Foundation-Server TFS Azure-DevOps - https://github.com/cake-contrib/Cake.Tfs/releases/tag/0.2.6 + https://github.com/cake-contrib/Cake.Tfs/releases/tag/0.2.7