Esempio n. 1
0
        public void TestRead()
        {
            WriteRegistries("<registries>\n" +
                            "  <registry name=\"Reg1\"\n" +
                            "            url=\"https://reg1.com\"\n" +
                            "            termsOfService=\"https://reg1.com/terms\"\n" +
                            "            privacyPolicy=\"https://reg1.com/privacy\">\n" +
                            "    <scopes>\n" +
                            "      <scope>com.reg1</scope>\n" +
                            "    </scopes>\n" +
                            "  </registry>\n" +
                            "  <registry name=\"Reg2\"\n" +
                            "            url=\"https://reg2.com\">\n" +
                            "    <scopes>\n" +
                            "      <scope>com.reg2.foo</scope>\n" +
                            "      <scope>com.reg2.bar</scope>\n" +
                            "    </scopes>\n" +
                            "  </registry>\n" +
                            "</registries>\n");
            Assert.That(registries.Read(TEST_CONFIGURATION_FILENAME, logger), Is.EqualTo(true));
            Assert.That(registries.Registries.Count, Is.EqualTo(2));
            CollectionAssert.AreEquivalent(registries.Registries.Keys,
                                           new [] { "https://reg1.com", "https://reg2.com" });
            var reg1 = registries.Registries["https://reg1.com"];

            Assert.That(reg1.Name, Is.EqualTo("Reg1"));
            Assert.That(reg1.Url, Is.EqualTo("https://reg1.com"));
            Assert.That(reg1.TermsOfService, Is.EqualTo("https://reg1.com/terms"));
            Assert.That(reg1.PrivacyPolicy, Is.EqualTo("https://reg1.com/privacy"));
            CollectionAssert.AreEquivalent(reg1.Scopes, new [] { "com.reg1" });
            var reg2 = registries.Registries["https://reg2.com"];

            Assert.That(reg2.Name, Is.EqualTo("Reg2"));
            Assert.That(reg2.Url, Is.EqualTo("https://reg2.com"));
            Assert.That(reg2.TermsOfService, Is.EqualTo(""));
            CollectionAssert.AreEquivalent(reg2.Scopes, new [] { "com.reg2.foo", "com.reg2.bar" });
        }