diff --git a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/AuthenticationProviderTests.cs b/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/AuthenticationProviderTests.cs deleted file mode 100644 index a7d21fd..0000000 --- a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/AuthenticationProviderTests.cs +++ /dev/null @@ -1,340 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Tests.Authentication -{ - using Issues.Testing; - using Shouldly; - using Tfs.Authentication; - using Xunit; - - public sealed class AuthenticationProviderTests - { - public sealed class TheAuthenticationNtlmMethod - { - [Fact] - public void Should_Return_TfsNtlmCredentials_Object() - { - // Given / When - var credentials = AuthenticationProvider.AuthenticationNtlm(); - - // Then - credentials.ShouldBeOfType(); - } - } - - public sealed class TheAuthenticationBasicMethod - { - [Fact] - public void Should_Throw_If_User_Name_Is_Null() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationBasic(null, "foo")); - - // Then - result.IsArgumentNullException("userName"); - } - - [Fact] - public void Should_Throw_If_User_Name_Is_Empty() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationBasic(string.Empty, "foo")); - - // Then - result.IsArgumentOutOfRangeException("userName"); - } - - [Fact] - public void Should_Throw_If_User_Name_Is_WhiteSpace() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationBasic(" ", "foo")); - - // Then - result.IsArgumentOutOfRangeException("userName"); - } - - [Fact] - public void Should_Throw_If_Password_Is_Null() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationBasic("foo", null)); - - // Then - result.IsArgumentNullException("password"); - } - - [Fact] - public void Should_Throw_If_Password_Is_Empty() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationBasic("foo", string.Empty)); - - // Then - result.IsArgumentOutOfRangeException("password"); - } - - [Fact] - public void Should_Throw_If_Password_Is_WhiteSpace() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationBasic("foo", " ")); - - // Then - result.IsArgumentOutOfRangeException("password"); - } - - [Fact] - public void Should_Return_TfsBasicCredentials_Object() - { - // Given / When - var credentials = AuthenticationProvider.AuthenticationBasic("foo", "bar"); - - // Then - credentials.ShouldBeOfType(); - } - - [Fact] - public void Should_Set_User_Name() - { - // Given - const string userName = "foo"; - - // When - var credentials = AuthenticationProvider.AuthenticationBasic(userName, "bar"); - - // Then - credentials.ShouldBeOfType(); - ((TfsBasicCredentials)credentials).UserName.ShouldBe(userName); - } - - [Fact] - public void Should_Set_Password() - { - // Given - const string password = "bar"; - - // When - var credentials = AuthenticationProvider.AuthenticationBasic("foo", password); - - // Then - credentials.ShouldBeOfType(); - ((TfsBasicCredentials)credentials).Password.ShouldBe(password); - } - } - - public sealed class TheAuthenticationPersonalAccessTokenMethod - { - [Fact] - public void Should_Throw_If_Personal_Access_Token_Is_Null() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationPersonalAccessToken(null)); - - // Then - result.IsArgumentNullException("personalAccessToken"); - } - - [Fact] - public void Should_Throw_If_Personal_Access_Token_Is_Empty() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationPersonalAccessToken(string.Empty)); - - // Then - result.IsArgumentOutOfRangeException("personalAccessToken"); - } - - [Fact] - public void Should_Throw_If_Personal_Access_Token_Is_WhiteSpace() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationPersonalAccessToken(" ")); - - // Then - result.IsArgumentOutOfRangeException("personalAccessToken"); - } - - [Fact] - public void Should_Return_TfsBasicCredentials_Object() - { - // Given / When - var credentials = AuthenticationProvider.AuthenticationPersonalAccessToken("foo"); - - // Then - credentials.ShouldBeOfType(); - } - - [Fact] - public void Should_Set_Personal_Access_Token() - { - // Given - const string personalAccessToken = "foo"; - - // When - var credentials = AuthenticationProvider.AuthenticationPersonalAccessToken(personalAccessToken); - - // Then - credentials.ShouldBeOfType(); - ((TfsBasicCredentials)credentials).UserName.ShouldBe(string.Empty); - ((TfsBasicCredentials)credentials).Password.ShouldBe(personalAccessToken); - } - } - - public sealed class TheAuthenticationOAuthMethod - { - [Fact] - public void Should_Throw_If_Access_Token_Is_Null() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationOAuth(null)); - - // Then - result.IsArgumentNullException("accessToken"); - } - - [Fact] - public void Should_Throw_If_Access_Token_Is_Empty() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationOAuth(string.Empty)); - - // Then - result.IsArgumentOutOfRangeException("accessToken"); - } - - [Fact] - public void Should_Throw_If_Access_Token_Is_WhiteSpace() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationOAuth(" ")); - - // Then - result.IsArgumentOutOfRangeException("accessToken"); - } - - [Fact] - public void Should_Return_TfsOAuthCredentials_Object() - { - // Given / When - var credentials = AuthenticationProvider.AuthenticationOAuth("foo"); - - // Then - credentials.ShouldBeOfType(); - } - - [Fact] - public void Should_Set_Access_Token() - { - // Given - const string accessToken = "foo"; - - // When - var credentials = AuthenticationProvider.AuthenticationOAuth(accessToken); - - // Then - credentials.ShouldBeOfType(); - ((TfsOAuthCredentials)credentials).AccessToken.ShouldBe(accessToken); - } - } - - public sealed class TheAuthenticationAzureActiveDirectoryMethod - { - [Fact] - public void Should_Throw_If_User_Name_Is_Null() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationAzureActiveDirectory(null, "foo")); - - // Then - result.IsArgumentNullException("userName"); - } - - [Fact] - public void Should_Throw_If_User_Name_Is_Empty() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationAzureActiveDirectory(string.Empty, "foo")); - - // Then - result.IsArgumentOutOfRangeException("userName"); - } - - [Fact] - public void Should_Throw_If_User_Name_Is_WhiteSpace() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationAzureActiveDirectory(" ", "foo")); - - // Then - result.IsArgumentOutOfRangeException("userName"); - } - - [Fact] - public void Should_Throw_If_Password_Is_Null() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationAzureActiveDirectory("foo", null)); - - // Then - result.IsArgumentNullException("password"); - } - - [Fact] - public void Should_Throw_If_Password_Is_Empty() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationAzureActiveDirectory("foo", string.Empty)); - - // Then - result.IsArgumentOutOfRangeException("password"); - } - - [Fact] - public void Should_Throw_If_Password_Is_WhiteSpace() - { - // Given / When - var result = Record.Exception(() => AuthenticationProvider.AuthenticationAzureActiveDirectory("foo", " ")); - - // Then - result.IsArgumentOutOfRangeException("password"); - } - - [Fact] - public void Should_Return_TfsAadCredentials_Object() - { - // Given / When - var credentials = AuthenticationProvider.AuthenticationAzureActiveDirectory("foo", "bar"); - - // Then - credentials.ShouldBeOfType(); - } - - [Fact] - public void Should_Set_User_Name() - { - // Given - const string userName = "foo"; - - // When - var credentials = AuthenticationProvider.AuthenticationAzureActiveDirectory(userName, "bar"); - - // Then - credentials.ShouldBeOfType(); - ((TfsAadCredentials)credentials).UserName.ShouldBe(userName); - } - - [Fact] - public void Should_Set_Password() - { - // Given - const string password = "bar"; - - // When - var credentials = AuthenticationProvider.AuthenticationAzureActiveDirectory("foo", password); - - // Then - credentials.ShouldBeOfType(); - ((TfsAadCredentials)credentials).Password.ShouldBe(password); - } - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsAadCredentialsTests.cs b/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsAadCredentialsTests.cs deleted file mode 100644 index 02506ef..0000000 --- a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsAadCredentialsTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Tests.Authentication -{ - using Shouldly; - using Tfs.Authentication; - using Xunit; - - public sealed class TfsAadCredentialsTests - { - public sealed class TheCtor - { - [Theory] - [InlineData("foo")] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] - public void Should_Set_User_Name(string userName) - { - // When - var credentials = new TfsAadCredentials(userName, "bar"); - - // Then - credentials.UserName.ShouldBe(userName); - } - - [Theory] - [InlineData("bar")] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] - public void Should_Set_Password_Name(string password) - { - // When - var credentials = new TfsAadCredentials("foo", password); - - // Then - credentials.Password.ShouldBe(password); - } - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsBasicCredentialsTests.cs b/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsBasicCredentialsTests.cs deleted file mode 100644 index 03cf333..0000000 --- a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsBasicCredentialsTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Tests.Authentication -{ - using Shouldly; - using Tfs.Authentication; - using Xunit; - - public sealed class TfsBasicCredentialsTests - { - public sealed class TheCtor - { - [Theory] - [InlineData("foo")] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] - public void Should_Set_User_Name(string userName) - { - // When - var credentials = new TfsBasicCredentials(userName, "bar"); - - // Then - credentials.UserName.ShouldBe(userName); - } - - [Theory] - [InlineData("bar")] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] - public void Should_Set_Password_Name(string password) - { - // When - var credentials = new TfsBasicCredentials("foo", password); - - // Then - credentials.Password.ShouldBe(password); - } - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsNtlmCredentialsTests.cs b/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsNtlmCredentialsTests.cs deleted file mode 100644 index 421038e..0000000 --- a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsNtlmCredentialsTests.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Tests.Authentication -{ - using Shouldly; - using Tfs.Authentication; - using Xunit; - - public sealed class TfsNtlmCredentialsTests - { - public sealed class TheCtor - { - [Fact] - public void Should_Not_Throw() - { - // Given / When - var credentials = new TfsNtlmCredentials(); - - // Then - credentials.ShouldBeOfType(); - } - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsOAuthCredentialsTests.cs b/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsOAuthCredentialsTests.cs deleted file mode 100644 index 4fc3388..0000000 --- a/src/Cake.Issues.PullRequests.Tfs.Tests/Authentication/TfsOAuthCredentialsTests.cs +++ /dev/null @@ -1,56 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Tests.Authentication -{ - using Shouldly; - using Testing; - using Tfs.Authentication; - using Xunit; - - public sealed class TfsOAuthCredentialsTests - { - public sealed class TheCtor - { - [Fact] - public void Should_Throw_If_Access_Token_Is_Null() - { - // Given / When - var result = Record.Exception(() => new TfsOAuthCredentials(null)); - - // Then - result.IsArgumentNullException("accessToken"); - } - - [Fact] - public void Should_Throw_If_Access_Token_Is_Empty() - { - // Given / When - var result = Record.Exception(() => new TfsOAuthCredentials(string.Empty)); - - // Then - result.IsArgumentOutOfRangeException("accessToken"); - } - - [Fact] - public void Should_Throw_If_Access_Token_Is_WhiteSpace() - { - // Given / When - var result = Record.Exception(() => new TfsOAuthCredentials(" ")); - - // Then - result.IsArgumentOutOfRangeException("accessToken"); - } - - [Fact] - public void Should_Set_Access_Token() - { - // Given - const string accessToken = "foo"; - - // When - var credentials = new TfsOAuthCredentials(accessToken); - - // Then - credentials.AccessToken.ShouldBe(accessToken); - } - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs.Tests/Cake.Issues.PullRequests.Tfs.Tests.csproj b/src/Cake.Issues.PullRequests.Tfs.Tests/Cake.Issues.PullRequests.Tfs.Tests.csproj index c821187..f75184d 100644 --- a/src/Cake.Issues.PullRequests.Tfs.Tests/Cake.Issues.PullRequests.Tfs.Tests.csproj +++ b/src/Cake.Issues.PullRequests.Tfs.Tests/Cake.Issues.PullRequests.Tfs.Tests.csproj @@ -64,11 +64,6 @@ - - - - - diff --git a/src/Cake.Issues.PullRequests.Tfs.Tests/TfsCredentialsExtensionsTests.cs b/src/Cake.Issues.PullRequests.Tfs.Tests/TfsCredentialsExtensionsTests.cs index 3654a3d..65dd441 100644 --- a/src/Cake.Issues.PullRequests.Tfs.Tests/TfsCredentialsExtensionsTests.cs +++ b/src/Cake.Issues.PullRequests.Tfs.Tests/TfsCredentialsExtensionsTests.cs @@ -1,10 +1,8 @@ namespace Cake.Issues.PullRequests.Tfs.Tests { - using Cake.Issues.PullRequests.Tfs.Authentication; + using Cake.Issues.PullRequests.Tfs; using Cake.Issues.Testing; - using Microsoft.VisualStudio.Services.Client; - using Microsoft.VisualStudio.Services.Common; - using Microsoft.VisualStudio.Services.OAuth; + using Cake.Tfs.Authentication; using Shouldly; using Xunit; diff --git a/src/Cake.Issues.PullRequests.Tfs/Authentication/AuthenticationProvider.cs b/src/Cake.Issues.PullRequests.Tfs/Authentication/AuthenticationProvider.cs deleted file mode 100644 index 8b742f1..0000000 --- a/src/Cake.Issues.PullRequests.Tfs/Authentication/AuthenticationProvider.cs +++ /dev/null @@ -1,80 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Authentication -{ - /// - /// Class providing credentials for different authentication schemas. - /// - internal static class AuthenticationProvider - { - /// - /// Returns credentials for integrated / NTLM authentication. - /// Can only be used for on-premise Team Foundation Server. - /// - /// Credentials for integrated / NTLM authentication. - public static ITfsCredentials AuthenticationNtlm() - { - return new TfsNtlmCredentials(); - } - - /// - /// Returns credentials for basic authentication. - /// Can only be used for on-premise Team Foundation Server configured for basic authentication. - /// See https://www.visualstudio.com/en-us/docs/integrate/get-started/auth/tfs-basic-auth. - /// - /// User name. - /// Password. - /// Credentials for basic authentication. - public static ITfsCredentials AuthenticationBasic( - string userName, - string password) - { - userName.NotNullOrWhiteSpace(nameof(userName)); - password.NotNullOrWhiteSpace(nameof(password)); - - return new TfsBasicCredentials(userName, password); - } - - /// - /// Returns credentials for authentication with a personal access token. - /// Can be used for Team Foundation Server and Visual Studio Team Services. - /// - /// Personal access token. - /// Credentials for authentication with a personal access token. - public static ITfsCredentials AuthenticationPersonalAccessToken( - string personalAccessToken) - { - personalAccessToken.NotNullOrWhiteSpace(nameof(personalAccessToken)); - - return new TfsBasicCredentials(string.Empty, personalAccessToken); - } - - /// - /// Returns credentials for OAuth authentication. - /// Can only be used with Visual Studio Team Services. - /// - /// OAuth access token. - /// Credentials for OAuth authentication. - public static ITfsCredentials AuthenticationOAuth( - string accessToken) - { - accessToken.NotNullOrWhiteSpace(nameof(accessToken)); - - return new TfsOAuthCredentials(accessToken); - } - - /// - /// Returns credentials for authentication with an Azure Active Directory. - /// - /// User name. - /// Password. - /// Credentials for authentication with an Azure Active Directory. - public static ITfsCredentials AuthenticationAzureActiveDirectory( - string userName, - string password) - { - userName.NotNullOrWhiteSpace(nameof(userName)); - password.NotNullOrWhiteSpace(nameof(password)); - - return new TfsAadCredentials(userName, password); - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsAadCredentials.cs b/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsAadCredentials.cs deleted file mode 100644 index 0afedfe..0000000 --- a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsAadCredentials.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Authentication -{ - /// - /// Credentials for authentication with an Azure Active Directory. - /// - internal class TfsAadCredentials : TfsBasicCredentials - { - /// - /// Initializes a new instance of the class. - /// - /// User name. - /// Password. - public TfsAadCredentials(string userName, string password) - : base(userName, password) - { - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsBasicCredentials.cs b/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsBasicCredentials.cs deleted file mode 100644 index 6af7f48..0000000 --- a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsBasicCredentials.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Authentication -{ - /// - /// Credentials for basic authentication. - /// - internal class TfsBasicCredentials : ITfsCredentials - { - /// - /// Initializes a new instance of the class. - /// - /// User name. - /// Password. - public TfsBasicCredentials(string userName, string password) - { - this.UserName = userName; - this.Password = password; - } - - /// - /// Gets the user name. - /// - public string UserName { get; private set; } - - /// - /// Gets the password. - /// - public string Password { get; private set; } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsNtlmCredentials.cs b/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsNtlmCredentials.cs deleted file mode 100644 index 4b20d07..0000000 --- a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsNtlmCredentials.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Authentication -{ - /// - /// Credentials for integrated / NTLM authentication. - /// - internal class TfsNtlmCredentials : ITfsCredentials - { - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsOAuthCredentials.cs b/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsOAuthCredentials.cs deleted file mode 100644 index b1deb9e..0000000 --- a/src/Cake.Issues.PullRequests.Tfs/Authentication/TfsOAuthCredentials.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs.Authentication -{ - /// - /// Credentials for OAuth authentication. - /// - internal class TfsOAuthCredentials : ITfsCredentials - { - /// - /// Initializes a new instance of the class. - /// - /// OAuth access token. - public TfsOAuthCredentials(string accessToken) - { - accessToken.NotNullOrWhiteSpace(nameof(accessToken)); - - this.AccessToken = accessToken; - } - - /// - /// Gets the OAuth access token. - /// - public string AccessToken { get; private set; } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs/Cake.Issues.PullRequests.Tfs.csproj b/src/Cake.Issues.PullRequests.Tfs/Cake.Issues.PullRequests.Tfs.csproj index c0c3548..f40c8ed 100644 --- a/src/Cake.Issues.PullRequests.Tfs/Cake.Issues.PullRequests.Tfs.csproj +++ b/src/Cake.Issues.PullRequests.Tfs/Cake.Issues.PullRequests.Tfs.csproj @@ -40,6 +40,9 @@ + + 0.1.0-beta0001 + 3.1.0 @@ -73,16 +76,10 @@ - - - - - - @@ -92,7 +89,6 @@ - diff --git a/src/Cake.Issues.PullRequests.Tfs/GitPullRequestCommentThreadExtensions.cs b/src/Cake.Issues.PullRequests.Tfs/GitPullRequestCommentThreadExtensions.cs index b8bd5a7..df6cc0a 100644 --- a/src/Cake.Issues.PullRequests.Tfs/GitPullRequestCommentThreadExtensions.cs +++ b/src/Cake.Issues.PullRequests.Tfs/GitPullRequestCommentThreadExtensions.cs @@ -2,7 +2,6 @@ { using System; using System.Linq; - using Core.IO; using Microsoft.TeamFoundation.SourceControl.WebApi; /// diff --git a/src/Cake.Issues.PullRequests.Tfs/ITfsCredentials.cs b/src/Cake.Issues.PullRequests.Tfs/ITfsCredentials.cs deleted file mode 100644 index 1ba1dd5..0000000 --- a/src/Cake.Issues.PullRequests.Tfs/ITfsCredentials.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs -{ - /// - /// Interface for different credential types. - /// - public interface ITfsCredentials - { - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsCredentialsExtensions.cs b/src/Cake.Issues.PullRequests.Tfs/TfsCredentialsExtensions.cs index a754f92..7941ca2 100644 --- a/src/Cake.Issues.PullRequests.Tfs/TfsCredentialsExtensions.cs +++ b/src/Cake.Issues.PullRequests.Tfs/TfsCredentialsExtensions.cs @@ -1,6 +1,6 @@ namespace Cake.Issues.PullRequests.Tfs { - using Authentication; + using Cake.Tfs.Authentication; using Microsoft.VisualStudio.Services.Client; using Microsoft.VisualStudio.Services.Common; using Microsoft.VisualStudio.Services.OAuth; diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSettings.cs b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSettings.cs index 6c4b53d..f518d3d 100644 --- a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSettings.cs +++ b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSettings.cs @@ -1,6 +1,7 @@ namespace Cake.Issues.PullRequests.Tfs { using System; + using Cake.Tfs.Authentication; /// /// Settings for . diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs index 24a47f8..5732189 100644 --- a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs +++ b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs @@ -5,8 +5,8 @@ using System.Globalization; using System.Linq; using System.Threading; - using Core.Diagnostics; - using Core.IO; + using Cake.Core.Diagnostics; + using Cake.Core.IO; using Microsoft.TeamFoundation.SourceControl.WebApi; using Microsoft.VisualStudio.Services.Identity; using Microsoft.VisualStudio.Services.WebApi; diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.Authentication.cs b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.Authentication.cs deleted file mode 100644 index 9e25561..0000000 --- a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.Authentication.cs +++ /dev/null @@ -1,110 +0,0 @@ -namespace Cake.Issues.PullRequests.Tfs -{ - using Authentication; - using Core; - using Core.Annotations; - - /// - /// Contains functionality related to authentication. - /// - public static partial class TfsPullRequestSystemAliases - { - /// - /// Returns credentials for integrated / NTLM authentication. - /// Can only be used for on-premise Team Foundation Server. - /// - /// The context. - /// Credentials for integrated / NTLM authentication - [CakeMethodAlias] - [CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)] - public static ITfsCredentials TfsAuthenticationNtlm( - this ICakeContext context) - { - context.NotNull(nameof(context)); - - return AuthenticationProvider.AuthenticationNtlm(); - } - - /// - /// Returns credentials for basic authentication. - /// Can only be used for on-premise Team Foundation Server configured for basic authentication. - /// See https://www.visualstudio.com/en-us/docs/integrate/get-started/auth/tfs-basic-auth. - /// - /// The context. - /// User name. - /// Password. - /// Credentials for basic authentication. - [CakeMethodAlias] - [CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)] - public static ITfsCredentials TfsAuthenticationBasic( - this ICakeContext context, - string userName, - string password) - { - context.NotNull(nameof(context)); - userName.NotNullOrWhiteSpace(nameof(userName)); - password.NotNullOrWhiteSpace(nameof(password)); - - return AuthenticationProvider.AuthenticationBasic(userName, password); - } - - /// - /// Returns credentials for authentication with a personal access token. - /// Can be used for Team Foundation Server and Visual Studio Team Services. - /// - /// The context. - /// Personal access token. - /// Credentials for authentication with a personal access token. - [CakeMethodAlias] - [CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)] - public static ITfsCredentials TfsAuthenticationPersonalAccessToken( - this ICakeContext context, - string personalAccessToken) - { - context.NotNull(nameof(context)); - personalAccessToken.NotNullOrWhiteSpace(nameof(personalAccessToken)); - - return AuthenticationProvider.AuthenticationPersonalAccessToken(personalAccessToken); - } - - /// - /// Returns credentials for OAuth authentication. - /// Can only be used with Visual Studio Team Services. - /// - /// The context. - /// OAuth access token. - /// Credentials for OAuth authentication. - [CakeMethodAlias] - [CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)] - public static ITfsCredentials TfsAuthenticationOAuth( - this ICakeContext context, - string accessToken) - { - context.NotNull(nameof(context)); - accessToken.NotNullOrWhiteSpace(nameof(accessToken)); - - return AuthenticationProvider.AuthenticationOAuth(accessToken); - } - - /// - /// Returns credentials for authentication with an Azure Active Directory. - /// - /// The context. - /// User name. - /// Password. - /// Credentials for authentication with an Azure Active Directory. - [CakeMethodAlias] - [CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)] - public static ITfsCredentials TfsAuthenticationAzureActiveDirectory( - this ICakeContext context, - string userName, - string password) - { - context.NotNull(nameof(context)); - userName.NotNullOrWhiteSpace(nameof(userName)); - password.NotNullOrWhiteSpace(nameof(password)); - - return AuthenticationProvider.AuthenticationAzureActiveDirectory(userName, password); - } - } -} diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.PullRequestSystem.cs b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.PullRequestSystem.cs index 0cf78c1..aa73db2 100644 --- a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.PullRequestSystem.cs +++ b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.PullRequestSystem.cs @@ -1,8 +1,9 @@ namespace Cake.Issues.PullRequests.Tfs { using System; - using Core; - using Core.Annotations; + using Cake.Core; + using Cake.Core.Annotations; + using Cake.Tfs.Authentication; /// /// Contains functionality related to . diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs index 1010a10..3cb3172 100644 --- a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs +++ b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs @@ -1,6 +1,6 @@ namespace Cake.Issues.PullRequests.Tfs { - using Core.Annotations; + using Cake.Core.Annotations; /// /// Contains functionality related to writing code analysis issues to Team Foundation Server or