示例#1
0
        public void TestLookup()
        {
            var credentialResolver = new CredentialResolver();
            var credential         = credentialResolver.LookupAsync("correlationId").Result;

            Assert.Null(credential);

            var restConfigWithoutStoreKey = ConfigParams.FromTuples(
                "credential.username", "Negrienko",
                "credential.password", "qwerty",
                "credential.access_key", "key"
                );

            credentialResolver = new CredentialResolver(restConfigWithoutStoreKey);
            credential         = credentialResolver.LookupAsync("correlationId").Result;

            Assert.Equal("Negrienko", credential.Get("username"));
            Assert.Equal("qwerty", credential.Get("password"));
            Assert.Equal("key", credential.Get("access_key"));
            Assert.Null(credential.Get("store_key"));

            credentialResolver = new CredentialResolver(RestConfig);
            credentialResolver.SetReferences(new References());
            try
            {
                credential = credentialResolver.LookupAsync("correlationId").Result;
            }
            catch (Exception)
            {
                //Assert.IsType<ReferenceException>(ex);
            }
        }
示例#2
0
        public void TestConfigure()
        {
            var credentialResolver = new CredentialResolver(RestConfig);
            var config             = credentialResolver.GetAll().FirstOrDefault();

            Assert.Equal("Negrienko", config["username"]);
            Assert.Equal("qwerty", config["password"]);
            Assert.Equal("key", config["access_key"]);
            Assert.Equal("store key", config["store_key"]);
        }