public void TestLocalEnvironmentAppSettings()
        {
            #region arrange
            IAppSettings appSettings = new EnvironmentAppSettings();
            string       expected    = "value_test";
            #endregion

            #region act
            string actual = appSettings["test"];
            #endregion

            #region assert
            Assert.AreEqual(expected, actual);
            #endregion
        }
Exemplo n.º 2
0
        public ApplicationCredentials GetApplicationCredentials()
        {
            var appSettings = new EnvironmentAppSettings();

            var accountId = appSettings.GetString("B2AccountID");
            var applicationKey = appSettings.GetString("B2ApplicationKey");

            if (string.IsNullOrEmpty(accountId) || string.IsNullOrEmpty(applicationKey))
            {
                throw new ApplicationException(
                    "Can't load username or password, check if B2AccountID and B2ApplicationKey are set for the user (environment variables - B2AccountID, B2ApplicationKey)");
            }

            return new ApplicationCredentials()
            {
                AccountId = accountId,
                ApplicationKey = applicationKey
            };
        }