예제 #1
0
        public void TestSetSettings()
        {
            try
            {
                UTorrentClient client   = new UTorrentClient("admin", "password");
                var            response = client.GetSettings();

                Assert.IsNull(response.Error);
                Assert.IsNotNull(response.Result);
                Assert.IsNotNull(response.Result.Settings);
                Assert.AreNotEqual(response.Result.Settings.Count, 0);

                var searchListSetting = response.Result.Settings.FirstOrDefault(s => s.Key == "search_list");
                Assert.IsNotNull(searchListSetting);
                Assert.AreEqual(SettingType.String, searchListSetting.Type);
                Assert.AreEqual("Y", searchListSetting.Access);

                string value = searchListSetting.Value.ToString();

                response = client.SetSetting("search_list", value + "\r\nUniut test|http://localhost?q=");
                Assert.IsNull(response.Error);

                response = client.GetSettings();
                Assert.IsNull(response.Error);
                Assert.IsNotNull(response.Result);
                Assert.IsNotNull(response.Result.Settings);
                Assert.AreNotEqual(response.Result.Settings.Count, 0);

                searchListSetting = response.Result.Settings.FirstOrDefault(s => s.Key == "search_list");
                Assert.IsNotNull(searchListSetting);
                Assert.AreEqual(SettingType.String, searchListSetting.Type);
                Assert.AreEqual("Y", searchListSetting.Access);

                string newValue = searchListSetting.Value.ToString();

                Assert.AreEqual(value + "\r\nUniut test|http://localhost?q=", newValue);

                var resp = client.SetSetting("search_list", value);
            }
            catch (ServerUnavailableException)
            {
                Assert.Inconclusive("Serveur unavailable");
            }
        }
        public void TestSetSettings()
        {
            try
            {
                UTorrentClient client = new UTorrentClient("admin", "password");
                var response = client.GetSettings();

                Assert.IsNull(response.Error);
                Assert.IsNotNull(response.Result);
                Assert.IsNotNull(response.Result.Settings);
                Assert.AreNotEqual(response.Result.Settings.Count, 0);

                var searchListSetting = response.Result.Settings.FirstOrDefault(s => s.Key == "search_list");
                Assert.IsNotNull(searchListSetting);
                Assert.AreEqual(SettingType.String, searchListSetting.Type);
                Assert.AreEqual("Y", searchListSetting.Access);

                string value = searchListSetting.Value.ToString();

                response = client.SetSetting("search_list", value + "\r\nUniut test|http://localhost?q=");
                Assert.IsNull(response.Error);

                response = client.GetSettings();
                Assert.IsNull(response.Error);
                Assert.IsNotNull(response.Result);
                Assert.IsNotNull(response.Result.Settings);
                Assert.AreNotEqual(response.Result.Settings.Count, 0);

                searchListSetting = response.Result.Settings.FirstOrDefault(s => s.Key == "search_list");
                Assert.IsNotNull(searchListSetting);
                Assert.AreEqual(SettingType.String, searchListSetting.Type);
                Assert.AreEqual("Y", searchListSetting.Access);

                string newValue = searchListSetting.Value.ToString();

                Assert.AreEqual(value + "\r\nUniut test|http://localhost?q=", newValue);

                var resp = client.SetSetting("search_list", value);

            }
            catch (ServerUnavailableException)
            {
                Assert.Inconclusive("Serveur unavailable");
            }
        }