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 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); }