コード例 #1
0
        public void Given_env_Variables_When_building_secrets_Then_variables_are_fetched()
        {
            var settings = new SecretSettings
            {
                AccountId        = 1,
                AccountName      = "test",
                AnotherAccountId = 34,
                APIToken         = "234",
                Password         = "******",
                TagId            = "123",
                TagName          = "yey",
                UserId           = "123"
            };

            var prefix    = SecretManager.EnvironmentVariablePrefix;
            var variables = new Dictionary <string, string>
            {
                { $"{prefix}AccountId", settings.AccountId.ToString() },
                { $"{prefix}AccountName", settings.AccountName },
                { $"{prefix}AnotherAccountId", settings.AnotherAccountId.ToString() },
                { $"{prefix}APIToken", settings.APIToken },
                { $"{prefix}Password", settings.Password },
                { $"{prefix}TagId", settings.TagId },
                { $"{prefix}TagName", settings.TagName },
                { $"{prefix}UserId", settings.UserId }
            };

            using var tempEnv = new TemporaryEnvironment(variables);
            var envLoadedSettings = SecretManager.LoadSettings();

            envLoadedSettings.Should().BeEquivalentTo(settings);
        }
コード例 #2
0
        public void PrintEnvSettings()
        {
            var envLoadedSettings = SecretManager.LoadSettings();
            var stringSettings    = JsonConvert.SerializeObject(envLoadedSettings);

            Console.WriteLine("Loaded secret settings");
            Console.WriteLine(stringSettings);
        }
コード例 #3
0
        public async Task Login_ValidCredentials_Authenticated_And_returns_Token()
        {
            var logger = LoggerFactory.Create(c => c.AddConsole()).CreateLogger <AuthTest>();

            var target = new BuxferClient("*****@*****.**", SecretManager.LoadSettings().Password, logger);
            var token  = await target.Login();

            Console.WriteLine($"token is {token}");
            Assert.NotNull(token);
            Assert.IsTrue(target.Authenticated);
        }
コード例 #4
0
        public async Task Login_withAPITokenWorks()
        {
            var logger = LoggerFactory.Create(c => c.AddConsole()).CreateLogger <AuthTest>();

            var apiToken = SecretManager.LoadSettings().APIToken;
            var target   = new BuxferClient(apiToken, logger);
            var token    = await target.Login();

            token.Should().Be(apiToken);

            Assert.IsTrue(target.Authenticated);
        }
コード例 #5
0
 public TransactionsTest()
 {
     BuxferClientAutoTestsTag = SecretManager.LoadSettings().TagName;
 }
コード例 #6
0
 public static BuxferClient BuildClient(out SecretSettings setting, ILogger logger = null)
 {
     setting = SecretManager.LoadSettings();
     return(BuildClient(setting, logger));
 }