public ServiceIntegrationTests() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile("appsettings.test.json", optional: true, reloadOnChange: true); var configuration = builder.Build(); OrgToken = new OrgToken(configuration.GetSection("whitesource:orgToken").Value); ProductToken = new ProductToken(configuration.GetSection("whitesource:productToken").Value); ProjectToken = new ProjectToken(configuration.GetSection("whitesource:projectToken").Value); LibraryUuid = configuration.GetSection("whitesource:libraryUuid").Value; service = new WhitesourceService(configuration.GetSection("whitesource:userKey").Value, configuration.GetSection("whitesource:url").Value); }
/* --- Private methods --- */ private void CreateService() { Log(Level.Debug, "Service Url is " + WssUrl); if (Proxy == null) { service = new WhitesourceService(Consts.AGENT_TYPE, Consts.AGENT_VERSION, WssUrl); } else { Credential credentials = Proxy.Credentials; if (credentials == null) { service = new WhitesourceService(Consts.AGENT_TYPE, Consts.AGENT_VERSION, WssUrl, Proxy.Host, Proxy.Port); } else { service = new WhitesourceService(Consts.AGENT_TYPE, Consts.AGENT_VERSION, WssUrl, Proxy.Host, Proxy.Port, credentials.UserName, credentials.Password); } } service.SetDebug(Debug || Level.Debug == Project.Threshold); }