public static void ValidateTenantConfig(this ICakeContext context, ValidateTenantArgs args) { DependencyConfig.Setup(args, context).GetAwaiter().GetResult(); var cmd = DependencyConfig.Container.GetService <ValidateTenantCommand>(); cmd.Execute().GetAwaiter().GetResult(); }
public ValidateTenantCommand(ValidateTenantArgs args, ISecretsMananger secretsMananger, ITenantManager tenantManager, VariableConverter jsonValidator, IFileSystem fileSystem, ILogger logger) { _args = args ?? throw new ArgumentNullException(nameof(args)); _secretsMananger = secretsMananger ?? throw new ArgumentNullException(nameof(secretsMananger)); _tenantManager = tenantManager ?? throw new ArgumentNullException(nameof(tenantManager)); _jsonValidator = jsonValidator ?? throw new ArgumentNullException(nameof(jsonValidator)); _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public async Task VariablesAreSetCorrectly(string json, [Frozen] Mock <ISecretsMananger> mockSecret, [Frozen] Mock <ITenantManager> mockTenant, [Frozen] MockFileSystem mockFileSystem, [Frozen] ValidateTenantArgs args, ValidateTenantCommand sut) { 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); mockTenant.Verify(m => m.CreateTenantVariables(It.Is <List <SecretVariable> >(l => l.Count == 1), It.Is <bool>(b => !b)), Times.Once); }
public async Task ValidateTenantArgsAddedAndSubTypes(Mock <IServiceCollection> mockColl, ValidateTenantArgs args) { await DependencyConfig.Setup(args, null, mockColl.Object, false).ConfigureAwait(false); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ValidateTenantArgs))), Times.Once); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(TenantTargetArgs))), Times.Once); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(IProjectArgsBase))), Times.Once); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(FileArgsBase))), Times.Once); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ArgsBase))), Times.Once); }