public IOptions <OntraportConfig> GetConfig()
        {
            var builder = new ConfigurationBuilder()
                          .AddUserSecrets <ConfigHelper>();
            var configuration = builder.Build();

            var appId  = configuration["OntraportAppId"];
            var apiKey = configuration["OntraportApiKey"];

            if (string.IsNullOrEmpty(appId) || string.IsNullOrEmpty(apiKey))
            {
                throw new ArgumentException(
                          @"Ontraport API credentials must be set in your User Secret Manager. Open the command-line tool and navigate to the OntraportApi.IntegrationTests project directory.

Use the following commands to set your keys. (Ask Ontraport for a SandBox account and get your keys in the admin section):
dotnet user-secrets set OntraportAppId ""your-app-id-here""
dotnet user-secrets set OntraportApiKey ""your-api-key-here""");
            }

            var config = new OntraportConfig()
            {
                AppId  = appId,
                ApiKey = apiKey
            };

            return(Mock.Of <IOptions <OntraportConfig> >(x => x.Value == config));
        }
示例#2
0
        /// <summary>
        /// Returns sandbox account information for Ontraport.
        /// </summary>
        public static IOptions <OntraportConfig> GetOntraportSandBoxConfig()
        {
            var config = new OntraportConfig()
            {
                AppId  = "2_200032_vRJdfd92u",
                ApiKey = "JQt4G2decluimoA"
            };

            return(Mock.Of <IOptions <OntraportConfig> >(x => x.Value == config));
        }