public void TestConnectWithoutAuth()
        {
            var connector = new BishopHttpCastleConnector(new PluginSettings {
                DiagnosticsUrl = new Uri("http://localhost:50890/test/"),
            });
            var configs = connector.ReadApplicationConfigs();

            Assert.NotEmpty(configs);
        }
Example #2
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            var testSettings = new PluginSettings {
                DiagnosticsUrl = new Uri(TxtCastleUrl.Text),
                UserName       = TxtCastleUsername.Text
            };

            testSettings.SetPassword(TxtCastlePassword.Text);
            var connector = new BishopHttpCastleConnector(testSettings);

            if (connector.AreSettingsValid())
            {
                MessageBox.Show(this, "Connection successful", "Test connection", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(this, "Connection failed", "Test connection", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void TestConnectWithAuth()
        {
            var settings = new PluginSettings {
                DiagnosticsUrl = new Uri("http://localhost:50890/test/"),
                UserName       = "******"
            };

            settings.SetPassword("Fiddler");

            var connector = new BishopHttpCastleConnector(settings);

            Assert.False(connector.AreSettingsValid());
            Assert.Throws <Exception>(() => connector.ReadApplicationConfigs());

            settings.SetPassword("Fiddler1");
            Assert.True(connector.AreSettingsValid());
            var configs = connector.ReadApplicationConfigs();

            Assert.NotEmpty(configs);
        }