public static void UploadProject(this ICakeContext context, UploadProjectArgs args) { DependencyConfig.Setup(args, context).GetAwaiter().GetResult(); var cmd = DependencyConfig.Container.GetService <UploadProjectCommand>(); cmd.Execute().GetAwaiter().GetResult(); }
public async Task SecretsAreReplaced(string json, [Frozen] Mock <ISecretsMananger> mockSecret, [Frozen] MockFileSystem mockFileSystem, [Frozen] UploadProjectArgs args, UploadProjectCommand sut) { args.VaultRoleId = "RoleId"; args.VaultSecretId = "SecretId"; args.VaultUri = "Uri"; mockFileSystem.AddFile(args.File, new MockFileData(json)); await sut.Execute().ConfigureAwait(false); mockSecret.Verify(m => m.ReplaceSecrets(It.Is <List <SecretVariable> >(l => l.Count == 1), args), Times.Once); }
public UploadProjectCommand(UploadProjectArgs args, ISecretsMananger secretsMananger, IProjectManager projectManager, IProjectClearer projectClearer, VariableConverter variableConverter, IFileSystem fileSystem, ILogger logger) { _args = args ?? throw new ArgumentNullException(nameof(args)); _secretsMananger = secretsMananger ?? throw new ArgumentNullException(nameof(secretsMananger)); _varConverter = variableConverter ?? throw new ArgumentNullException(nameof(variableConverter)); _projectManager = projectManager ?? throw new ArgumentNullException(nameof(projectManager)); _projectClearer = projectClearer ?? throw new ArgumentNullException(nameof(projectClearer)); _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public async Task ProjectTemplateDoesClear(string json, [Frozen] Mock <IProjectManager> mockProject, [Frozen] Mock <IProjectClearer> mockClearer, [Frozen] MockFileSystem mockFileSystem, [Frozen] UploadProjectArgs args, UploadProjectCommand sut) { args.ClearProject = true; mockFileSystem.AddFile(args.File, new MockFileData(json)); await sut.Execute().ConfigureAwait(false); mockClearer.Verify(m => m.ClearProjectVariables(), Times.Once); mockProject.Verify(m => m.CreateProjectVariables(It.IsAny <List <SecretVariable> >(), true), Times.Once); }
public async Task VariablesAreSetCorrectly(string json, [Frozen] Mock <IProjectManager> mockProject, [Frozen] Mock <IProjectClearer> mockClearer, [Frozen] MockFileSystem mockFileSystem, [Frozen] UploadProjectArgs args, UploadProjectCommand sut) { mockFileSystem.AddFile(args.File, new MockFileData(json)); await sut.Execute().ConfigureAwait(false); if (args.ClearProject) { mockClearer.Verify(m => m.ClearProjectVariables(), Times.Once); } mockProject.Verify(m => m.CreateProjectVariables(It.Is <List <SecretVariable> >(l => l.Count == 1), true), Times.Once); }