public void TestRebuildIndex()
        {
            var target = new CloudsearchApplication(mockApi);

            var result = target.RebuildIndex("hotel", null, null);
            var j      = Utilities.ConvertResult(result);

            Assert.AreEqual("OK", j.Status);
        }
Ejemplo n.º 2
0
        public void TestGetErrorMessage()
        {
            var target = new CloudsearchApplication(api);
            var result = target.GetErrorMessage("hotel");

            var jo = JObject.Parse(result);

            Assert.Equal("OK", (string)jo["status"]);
        }
        public void testCreateIndex()
        {
            var    indexName = "index";
            var    target    = new CloudsearchApplication(mockApi);
            var    template  = "news";
            string result;

            result = target.CreateByTemplate(indexName, template);
            Console.WriteLine(result);
            Assert.IsTrue(result.IndexOf("action=create&template=news") >= 0);
        }
Ejemplo n.º 4
0
        public void TestListIndex()
        {
            var target = new CloudsearchApplication(mockApi);

            var result = target.ListApplications();

            AssertPath("/index", result);
            AssertEqualFromQueryString("page", "1", result);

            result = target.ListApplications(2, 2);
            AssertEqualFromQueryString("page", "2", result);
        }
Ejemplo n.º 5
0
        public void TestStatusIndex()
        {
            var target = new CloudsearchApplication(api);

            var result = target.Status("hotel");

            Console.WriteLine(result);
            //Assert.Equal(expected, actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
            var jo = JObject.Parse(result);

            Assert.Equal("OK", (string)jo["status"]);
        }
Ejemplo n.º 6
0
        public void TestCreateIndex()
        {
            var    appName  = DateTime.UtcNow.Ticks.ToString();
            var    target   = new CloudsearchApplication(api);
            var    template = "template1";
            string actual;

            actual = target.CreateByTemplate(appName, template);
            Console.WriteLine(actual);

            var jo = JObject.Parse(actual);

            //Console.WriteLine(result);
            Assert.Equal("OK", (string)jo["status"]);


            actual = target.Delete(appName);
            Console.WriteLine(actual);

            //"result":{"index_name":"4N0F6H","description":""},"status":"OK"}
            jo = JObject.Parse(actual);
            Assert.Equal("OK", (string)jo["status"]);
        }