public void Should_Throw_If_Settings_Are_Null() { // Given AzureDevOpsBuildsSettings settings = null; // When var result = Record.Exception(() => new AzureDevOpsBuildsSettings(settings)); // Then result.IsArgumentNullException("settings"); }
public static IEnumerable <AzureDevOpsBuild> AzureDevOpsBuilds( this ICakeContext context, AzureDevOpsBuildsSettings settings) { context.NotNull(nameof(context)); settings.NotNull(nameof(settings)); return(AzureDevOpsBuildsHelper.GetAzureDevOpsBuilds( context.Log, settings)); }
public void Should_Set_Credentials() { // Given var collectionUrl = new Uri("http://example.com/collection"); var projectGuid = Guid.NewGuid(); var credentials = AuthenticationProvider.AuthenticationNtlm(); // When var result = new AzureDevOpsBuildsSettings(collectionUrl, projectGuid, credentials); // Then result.Credentials.ShouldBe(credentials); }
public void Should_Throw_If_System_Access_Token_Env_Var_Is_WhiteSpace() { // Given Environment.SetEnvironmentVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", "https://example.com/collection"); Environment.SetEnvironmentVariable("SYSTEM_TEAMPROJECT", "MyProject"); Environment.SetEnvironmentVariable("SYSTEM_ACCESSTOKEN", " "); // When var result = Record.Exception(() => AzureDevOpsBuildsSettings.UsingAzurePipelinesOAuthToken()); // Then result.IsInvalidOperationException(); }
public void Should_Throw_If_Collection_Url_Env_Var_Is_Not_Set() { // Given Environment.SetEnvironmentVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", null); Environment.SetEnvironmentVariable("SYSTEM_TEAMPROJECT", "MyProject"); Environment.SetEnvironmentVariable("SYSTEM_ACCESSTOKEN", "foo"); // When var result = Record.Exception(() => AzureDevOpsBuildsSettings.UsingAzurePipelinesOAuthToken()); // Then result.IsInvalidOperationException(); }
public void Should_Set_ProjectName() { // Given var collectionUrl = new Uri("http://example.com/collection"); var projectName = "MyProject"; var credentials = AuthenticationProvider.AuthenticationNtlm(); // When var result = new AzureDevOpsBuildsSettings(collectionUrl, projectName, credentials); // Then result.ProjectName.ShouldBe(projectName); }
public void Should_Set_Credentials() { // Given var creds = new AzureDevOpsNtlmCredentials(); Environment.SetEnvironmentVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", "https://example.com/collection"); Environment.SetEnvironmentVariable("SYSTEM_TEAMPROJECT", "MyProject"); // When var settings = new AzureDevOpsBuildsSettings(creds); // Then settings.Credentials.ShouldBe(creds); }
public void Should_Set_Collection_Url() { // Given var creds = new AzureDevOpsNtlmCredentials(); Environment.SetEnvironmentVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", "https://example.com/collection"); Environment.SetEnvironmentVariable("SYSTEM_TEAMPROJECT", "MyProject"); Environment.SetEnvironmentVariable("SYSTEM_ACCESSTOKEN", "foo"); // When var settings = new AzureDevOpsBuildsSettings(creds); // Then settings.CollectionUrl.ToString().ShouldBe(new Uri("https://example.com/collection").ToString()); }
public void Should_Set_Project_Name() { // Given var projectName = "MyProject"; var creds = new AzureDevOpsNtlmCredentials(); Environment.SetEnvironmentVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", "https://example.com/collection"); Environment.SetEnvironmentVariable("SYSTEM_TEAMPROJECT", projectName); Environment.SetEnvironmentVariable("SYSTEM_ACCESSTOKEN", "foo"); // When var settings = new AzureDevOpsBuildsSettings(creds); // Then settings.ProjectName.ShouldBe(projectName); }