public ConfigurationWindow()
        {
            InitializeComponent();

            InaraConfiguration inaraConfiguration = InaraConfiguration.FromFile();

            inaraApiKeyTextBox.Text = inaraConfiguration.apiKey;
        }
        private void updateInaraConfiguration()
        {
            InaraConfiguration inaraConfiguration = InaraConfiguration.FromFile();

            if (!string.IsNullOrWhiteSpace(inaraApiKeyTextBox.Text))
            {
                inaraConfiguration.apiKey = inaraApiKeyTextBox.Text.Trim();
            }
            inaraConfiguration.ToFile();
            EDDI.Instance.Reload("Inara responder");
        }
Exemple #3
0
        public void TestIndexAndFilterAPIEvents()
        {
            List <InaraAPIEvent> inaraAPIEvents = new List <InaraAPIEvent>()
            {
                { new InaraAPIEvent(DateTime.UtcNow, "getCommanderProfile", new Dictionary <string, object>()
                    {
                        { "searchName", "No such name" }
                    }) },
                { new InaraAPIEvent(DateTime.UtcNow, "getCommanderProfile", new Dictionary <string, object>()
                    {
                        { "searchName", "Artie" }
                    }) }
            };
            PrivateObject privateInaraService = new PrivateObject(typeof(InaraService));
            var           results             = (List <InaraAPIEvent>)privateInaraService.Invoke("IndexAndFilterAPIEvents", new object[] { inaraAPIEvents, InaraConfiguration.FromFile() });

            if (results.Count == 2)
            {
                // Check that appropriate response IDs were assigned to each API event
                Assert.AreEqual(0, results[0].eventCustomID);
                Assert.AreEqual(1, results[1].eventCustomID);
            }
            else
            {
                Assert.Fail();
            }
        }