Esempio n. 1
0
        public void GetListFromCredentials_ThrowsWhenListNotPossible()
        {
            var credentials = new Dictionary <string, Credential>()
            {
                {
                    "foo", new Credential()
                    {
                        {
                            "bar", new Credential()
                            {
                                { "bang", new Credential("badabing") }
                            }
                        },
                    }
                }
            };
            var tags   = new Tags(new string[] { "foo", "bar" });
            var scheme = "scheme";

            var sif = new TestServiceInfoFactory(tags, scheme);
            var ex  = Assert.Throws <ConnectorException>(() => sif.GetListFromCredentials(credentials, "foo"));

            Assert.Contains("key=foo", ex.Message);
            Assert.Contains("value=bar/", ex.Message);
        }
Esempio n. 2
0
        public void GetListFromCredentials_ReturnsCorrect()
        {
            var credentials = new Dictionary <string, Credential>()
            {
                {
                    "uris", new Credential()
                    {
                        { "0", new Credential("https://foo:11") },
                        { "1", new Credential("https://bar:11") }
                    }
                }
            };
            var tags   = new Tags(new string[] { "foo", "bar" });
            var scheme = "scheme";

            var sif  = new TestServiceInfoFactory(tags, scheme);
            var list = sif.GetListFromCredentials(credentials, "uris");

            Assert.NotNull(list);
            Assert.Equal(2, list.Count);
            Assert.True(list[0].Equals("https://foo:11") || list[0].Equals("https://bar:11"));
            Assert.True(list[1].Equals("https://foo:11") || list[1].Equals("https://bar:11"));
        }