Example #1
0
        public void AddJobTaskDefinition_AdditionalConfigNull_AdditionalConfigRequiredException()
        {
            _pluginRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <Plugin> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Plugin {
                Id = 3, Name = "GitHubProvider", Type = PluginType.RepositoryProvider
            });

            _pluginAdditionalConfigRepository.Setup(r => r.GetBySpec(It.IsAny <ISpecification <PluginAdditionalConfig> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new List <PluginAdditionalConfig>
            {
                new PluginAdditionalConfig
                {
                    Id         = 1,
                    Name       = "testconfig",
                    IsRequired = true
                }
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId        = 1,
                Type                   = JobTaskDefinitionType.Push,
                AdditionalConfigString = null,
                Provider               = "GitHubProvider"
            }));

            Assert.IsType <PluginAdditionalConfigRequiredException>(exception?.Result);
        }
Example #2
0
        public void AddJobTaskDefinition_IncorrectExternalServiceTypeException()
        {
            _pluginRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <Plugin> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Plugin {
                Id = 3, Name = "GitHubProvider", Type = PluginType.RepositoryProvider, RequiredServicesString = "GitHub"
            });

            _externalServiceRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <ExternalService> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(
                new ExternalService {
                Id = 3, Name = "azure-default", ExternalServiceTypeId = 1,
                ExternalServiceType = new ExternalServiceType
                {
                    Id   = 1,
                    Name = "Azure"
                }
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId = 1,
                Type            = JobTaskDefinitionType.Push,
                ConfigString    = @"{""GitHubExternalService"":""azure-default""}",
                Provider        = "GitHubProvider"
            }));

            Assert.IsType <IncorrectExternalServiceTypeException>(exception?.Result);
        }
Example #3
0
        public async void GetJobDefinitions_ReturnItems()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var dataModels = await projectJobDefinitionService.GetJobDefinitions(1);

            Assert.NotEmpty(dataModels);
        }
Example #4
0
        public void AddJobDefinition_DuplicateItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobDefinition(1, "Default", false));

            Assert.IsType <DuplicateJobDefinitionException>(exception?.Result);
        }
Example #5
0
        public void AddJobDefinition_InvalidProject()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobDefinition(2, "Category", false));

            Assert.IsType <ProjectNotFoundException>(exception?.Result);
        }
Example #6
0
        public async void GetJobTaskDefinitions_ReturnEmpty()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var jobTaskDefinitions          = await projectJobDefinitionService.GetJobTaskDefinitions(2);

            Assert.Empty(jobTaskDefinitions);
        }
Example #7
0
        public async void GetJobTaskDefinitioById_ReturnItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var jobTaskDefinition           = await projectJobDefinitionService.GetJobTaskDefinitionById(1);

            Assert.NotNull(jobTaskDefinition);
        }
        public async void GetJobTaskDefinitioByName_ReturnItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _providerRepository.Object, _externalServiceRepository.Object, _providerAdditionalConfigRepository.Object, _secretVault.Object);
            var jobTaskDefinition           = await projectJobDefinitionService.GetJobTaskDefinitionByName(1, "Generate");

            Assert.NotNull(jobTaskDefinition);
        }
        public void AddJobTaskDefinition_TaskProviderAdditionalConfigAllowedValuesException()
        {
            _providerRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <TaskProvider> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new TaskProvider {
                Id = 3, Name = "GitHubProvider", Type = TaskProviderType.RepositoryProvider
            });

            _providerAdditionalConfigRepository.Setup(r => r.GetBySpec(It.IsAny <ISpecification <TaskProviderAdditionalConfig> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new List <TaskProviderAdditionalConfig>
            {
                new TaskProviderAdditionalConfig
                {
                    Id            = 1,
                    Name          = "testconfig",
                    AllowedValues = "test_value"
                }
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _providerRepository.Object, _externalServiceRepository.Object, _providerAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId        = 1,
                Type                   = JobTaskDefinitionType.Push,
                AdditionalConfigString = "{\"testconfig\":\"test\"}",
                ConfigString           = "{\"Repository\":\"test\"}",
                Provider               = "GitHubProvider"
            }));

            Assert.IsType <TaskProviderAdditionalConfigAllowedValuesException>(exception?.Result);
        }
Example #10
0
        public async void GetJobTaskDefinitionByName_ReturnEmpty()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var jobTaskDefinition           = await projectJobDefinitionService.GetJobTaskDefinitionByName(1, "Push");

            Assert.Null(jobTaskDefinition);
        }
Example #11
0
        public void AddJobTaskDefinition_IncorrectTaskType_InvalidPluginTypeException()
        {
            _pluginRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <Plugin> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Plugin {
                Id = 3, Name = "VstsBuildProvider", Type = PluginType.BuildProvider
            });

            _pluginAdditionalConfigRepository.Setup(r => r.GetBySpec(It.IsAny <ISpecification <PluginAdditionalConfig> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new List <PluginAdditionalConfig>
            {
                new PluginAdditionalConfig
                {
                    Id         = 1,
                    Name       = "testconfig",
                    IsRequired = true
                }
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId        = 1,
                Type                   = JobTaskDefinitionType.Push,
                AdditionalConfigString = "{}",
                Provider               = "VstsBuildProvider"
            }));

            Assert.IsType <InvalidPluginTypeException>(exception?.Result);

            var invalidPluginTypeException = exception?.Result as InvalidPluginTypeException;

            Assert.NotEmpty(invalidPluginTypeException.TaskTypes);
        }
Example #12
0
        public async void DeleteJobTaskDefinition_ValidItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            await projectJobDefinitionService.DeleteJobTaskDefinition(1);

            Assert.Empty(_dataTask);
        }
        public void AddJobDefinition_InvalidDefaultJobDefinition()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _providerRepository.Object, _externalServiceRepository.Object, _providerAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobDefinition(1, "Complete CI/CD", true, true));

            Assert.IsType <InvalidDefaultJobDefinition>(exception?.Result);
        }
Example #14
0
        public async void GetJobDefinitionByName_ReturnItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var projectJobDefinition        = await projectJobDefinitionService.GetJobDefinitionByName(1, "Default");

            Assert.NotNull(projectJobDefinition);
            Assert.Equal(1, projectJobDefinition.Id);
        }
Example #15
0
        public async void AddJobDefinition_ValidItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            int newId = await projectJobDefinitionService.AddJobDefinition(1, "Complete CI/CD", false);

            Assert.True(newId > 1);
            Assert.True(_data.Count > 1);
        }
Example #16
0
        public void AddJobDefinition_MultipleDeletionJob()
        {
            _data[0].IsDeletion = true;
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobDefinition(1, "Category", true));

            Assert.IsType <MultipleDeletionJobException>(exception?.Result);
        }
        public void SetJobDefinitionAsDefault_InvalidItem()
        {
            _data[0].IsDeletion = true;

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _providerRepository.Object, _externalServiceRepository.Object, _providerAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.SetJobDefinitionAsDefault(1));

            Assert.IsType <InvalidDefaultJobDefinition>(exception?.Result);
        }
Example #18
0
        public async void RenameJobDefinition_ValidItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            await projectJobDefinitionService.RenameJobDefinition(1, "newName");

            var dataModel = _data.First(d => d.Id == 1);

            Assert.Equal("newName", dataModel.Name);
        }
        public async void SetJobDefinitionAsDefault_ValidItem()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _providerRepository.Object, _externalServiceRepository.Object, _providerAdditionalConfigRepository.Object, _secretVault.Object);
            await projectJobDefinitionService.SetJobDefinitionAsDefault(1);

            var dataModel = _data.First(d => d.Id == 1);

            Assert.True(dataModel.IsDefault);
        }
Example #20
0
        public void AddJobTaskDefinition_InvalidJobDefinition()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId = 2,
                Type            = JobTaskDefinitionType.Push,
                ConfigString    = "test"
            }));

            Assert.IsType <JobDefinitionNotFoundException>(exception?.Result);
        }
Example #21
0
        public async void AddJobTaskDefinitions_ValidItem()
        {
            _pluginRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <Plugin> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Plugin {
                Id = 3, Name = "GitHubProvider", Type = PluginType.RepositoryProvider, RequiredServicesString = "GitHub"
            });

            _externalServiceRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <ExternalService> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(
                new ExternalService
            {
                Id   = 3,
                Name = "github-default",
                ExternalServiceTypeId = 1,
                ExternalServiceType   = new ExternalServiceType
                {
                    Id   = 1,
                    Name = "GitHub"
                }
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var newIds = await projectJobDefinitionService.AddJobTaskDefinitions(1, new List <JobTaskDefinition>
            {
                new JobTaskDefinition
                {
                    JobDefinitionId = 1,
                    Name            = "Clone",
                    Type            = JobTaskDefinitionType.Clone,
                    Provider        = "GitHubProvider",
                    ConfigString    = @"{""GitHubExternalService"":""github-default""}"
                },
                new JobTaskDefinition
                {
                    JobDefinitionId = 1,
                    Name            = "Push",
                    Type            = JobTaskDefinitionType.Push,
                    Provider        = "GitHubProvider",
                    ConfigString    = @"{""GitHubExternalService"":""github-default""}"
                }
            });

            Assert.True(newIds.Count > 1);
            foreach (var newId in newIds)
            {
                Assert.True(newId > 1);
            }

            Assert.True(_dataTask.Count > 1);
            Assert.Equal(1, _dataTask[1].Sequence);
            Assert.Equal(2, _dataTask[2].Sequence);
        }
Example #22
0
        public void AddJobTaskDefinition_JobTaskDefinitionTypeException()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);

            _data[0].IsDeletion = true;
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId = 1,
                Name            = "Push",
                Type            = JobTaskDefinitionType.Push
            }));

            Assert.IsType <JobTaskDefinitionTypeException>(exception?.Result);
        }
Example #23
0
        public void AddJobTaskDefinition_DuplicateJobTaskDefinitionException()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId        = 1,
                Name                   = "Generate",
                Type                   = JobTaskDefinitionType.Push,
                AdditionalConfigString = "{}",
                Provider               = "GitHubProvider"
            }));

            Assert.IsType <DuplicateJobTaskDefinitionException>(exception?.Result);
        }
Example #24
0
        public void RenameJobDefinition_DuplicateItem()
        {
            _data.Add(new JobDefinition
            {
                Id        = 2,
                ProjectId = 1,
                Name      = "newName"
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.RenameJobDefinition(1, "newName"));

            Assert.IsType <DuplicateJobDefinitionException>(exception?.Result);
        }
Example #25
0
        public async void AddJobTaskDefinition_ValidItem()
        {
            _pluginRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <Plugin> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Plugin {
                Id = 3, Name = "GitHubProvider", Type = PluginType.RepositoryProvider, RequiredServicesString = "GitHub"
            });

            _externalServiceRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <ExternalService> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(
                new ExternalService
            {
                Id   = 3,
                Name = "github-default",
                ExternalServiceTypeId = 1,
                ExternalServiceType   = new ExternalServiceType
                {
                    Id   = 1,
                    Name = "GitHub"
                }
            });

            _pluginAdditionalConfigRepository.Setup(r => r.GetBySpec(It.IsAny <ISpecification <PluginAdditionalConfig> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new List <PluginAdditionalConfig>
            {
                new PluginAdditionalConfig
                {
                    Id         = 1,
                    Name       = "testconfig",
                    IsRequired = true
                }
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            int newId = await projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId        = 1,
                Type                   = JobTaskDefinitionType.Push,
                ConfigString           = @"{""GitHubExternalService"":""github-default""}",
                AdditionalConfigString = @"{""testconfig"":""testvalue""}",
                Provider               = "GitHubProvider"
            });

            Assert.True(newId > 1);
            Assert.True(_dataTask.Count > 1);
            Assert.Equal(1, _dataTask[1].Sequence);
        }
        public void AddJobTaskDefinition_ExternalServiceNotFoundException()
        {
            _providerRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <TaskProvider> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new TaskProvider {
                Id = 3, Name = "GitHubProvider", Type = TaskProviderType.RepositoryProvider, RequiredServicesString = "GitHub"
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _providerRepository.Object, _externalServiceRepository.Object, _providerAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinition(new JobTaskDefinition
            {
                JobDefinitionId = 1,
                Type            = JobTaskDefinitionType.Push,
                ConfigString    = @"{""GitHubExternalService"":""github-default""}",
                Provider        = "GitHubProvider"
            }));

            Assert.IsType <ExternalServiceNotFoundException>(exception?.Result);
        }
Example #27
0
        public async void UpdateJobTaskConfig_ValidItem()
        {
            _pluginRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <Plugin> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Plugin {
                Id = 3, Name = "AspMvcNetCore", Type = PluginType.GeneratorProvider
            });

            var updatedConfig = new Dictionary <string, string>()
            {
                { "config1", "config 1 value" }
            };

            var updatedConfigString = JsonConvert.SerializeObject(updatedConfig);

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            await projectJobDefinitionService.UpdateJobTaskConfig(1, updatedConfig);

            var jobTaskDefinition = _dataTask.First(d => d.Id == 1);

            Assert.Equal(updatedConfigString, jobTaskDefinition.ConfigString);
        }
Example #28
0
        public async void UpdateJobTaskDefinition_ValidItem()
        {
            _pluginRepository.Setup(r => r.GetSingleBySpec(It.IsAny <ISpecification <Plugin> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Plugin {
                Id = 3, Name = "AspMvcNetCore", Type = PluginType.GeneratorProvider
            });

            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _pluginRepository.Object, _externalServiceRepository.Object, _pluginAdditionalConfigRepository.Object, _secretVault.Object);
            await projectJobDefinitionService.UpdateJobTaskDefinition(new JobTaskDefinition
            {
                Id = 1,
                JobDefinitionId = 1,
                Type            = JobTaskDefinitionType.Generate,
                Provider        = "AspMvcNetCore",
                ConfigString    = "testUpdated"
            });

            var jobTaskDefinition = _dataTask.First(d => d.Id == 1);

            Assert.Equal("testUpdated", jobTaskDefinition.ConfigString);
        }
        public void AddJobTaskDefinitions_JobDefinitionNotFound()
        {
            var projectJobDefinitionService = new JobDefinitionService(_jobDefinitionRepository.Object, _jobTaskDefinitionRepository.Object, _projectRepository.Object, _providerRepository.Object, _externalServiceRepository.Object, _providerAdditionalConfigRepository.Object, _secretVault.Object);
            var exception = Record.ExceptionAsync(() => projectJobDefinitionService.AddJobTaskDefinitions(2, new List <JobTaskDefinition>
            {
                new JobTaskDefinition
                {
                    JobDefinitionId = 1,
                    Type            = JobTaskDefinitionType.Push,
                    ConfigString    = "test"
                },
                new JobTaskDefinition
                {
                    JobDefinitionId = 1,
                    Type            = JobTaskDefinitionType.Build,
                    ConfigString    = "test2"
                }
            }));

            Assert.IsType <JobDefinitionNotFoundException>(exception?.Result);
        }
 public ExternalServiceRequiredException(string externalServiceTypeName, string providerName)
     : base($"Provider {providerName} require \"{JobDefinitionService.GetServiceTaskConfigKey(externalServiceTypeName)}\" in the task config")
 {
     ExternalServiceTypeName = externalServiceTypeName;
     ProviderName            = providerName;
 }