public void AddsSecretIdToProject() { var projectDir = _fixture.CreateProject(null); new InitCommand(null, null).Execute(MakeCommandContext(), projectDir); var idResolver = new ProjectIdResolver(MakeCommandContext().Reporter, projectDir); Assert.False(string.IsNullOrWhiteSpace(idResolver.Resolve(null, null))); }
public static string GetOrSetUserSecretsId(string projectFilePath) { var resolver = new ProjectIdResolver(NullReporter.Singleton, projectFilePath); var id = resolver.Resolve(projectFilePath, configuration: null); if (string.IsNullOrEmpty(id)) { return(UserSecretsCreator.CreateUserSecretsId(NullReporter.Singleton, projectFilePath, projectFilePath)); } return(id); }
internal string ResolveId(CommandLineOptions options, IReporter reporter) { if (!string.IsNullOrEmpty(options.Id)) { return(options.Id); } var resolver = new ProjectIdResolver(reporter, _workingDirectory); return(resolver.Resolve(options.Project, options.Configuration)); }
public void DoesNotGenerateIdForProjectWithSecretId() { const string SecretId = "AlreadyExists"; var projectDir = _fixture.CreateProject(SecretId); new InitCommand(null, null).Execute(MakeCommandContext(), projectDir); var idResolver = new ProjectIdResolver(MakeCommandContext().Reporter, projectDir); Assert.Equal(SecretId, idResolver.Resolve(null, null)); }
public void AddsEscapedSpecificSecretIdToProject() { const string SecretId = @"<lots of XML invalid values>&"; var projectDir = _fixture.CreateProject(null); new InitCommand(SecretId, null).Execute(MakeCommandContext(), projectDir); var idResolver = new ProjectIdResolver(MakeCommandContext().Reporter, projectDir); Assert.Equal(SecretId, idResolver.Resolve(null, null)); }
public void AddsSpecificSecretIdToProject() { const string SecretId = "TestSecretId"; var projectDir = _fixture.CreateProject(null); new InitCommand(SecretId, null).Execute(MakeCommandContext(), projectDir); var idResolver = new ProjectIdResolver(MakeCommandContext().Reporter, projectDir); Assert.Equal(SecretId, idResolver.Resolve(null, null)); }