Ejemplo n.º 1
0
 private void SetUpForDelete()
 {
     try
     {
         var client = new MeilisearchClient(_httpClient);
         var index  = client.GetIndex("MoviesToDelete").Result;
         if (index == null)
         {
             this.DocumentDeleteIndex = client.CreateIndex("MoviesToDelete").Result;
         }
         else
         {
             this.DocumentDeleteIndex = index;
         }
         var movies = new[]
         {
             new Movie {
                 Id = "10", Name = "SuperMan"
             },
         };
         var updateStatus = this.DocumentDeleteIndex.AddorUpdateDocuments(movies).Result;
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Ejemplo n.º 2
0
        public async Task Should_return_Null_If_the_Index_Does_not_Exist()
        {
            var _httpClient = ClientFactory.Instance.CreateClient <MeilisearchClient>();
            var client      = new MeilisearchClient(_httpClient);
            var indexes     = await client.GetIndex("somerandomIndex");

            indexes.Should().BeNull();
        }
Ejemplo n.º 3
0
        public async Task Should_return_the_index_requested()
        {
            var _httpClient = ClientFactory.Instance.CreateClient <MeilisearchClient>();
            var client      = new MeilisearchClient(_httpClient);
            var indexName   = "uid5" + new Random().Next();
            var index       = await client.CreateIndex(indexName, "movieId");

            var indexes = await client.GetIndex(indexName);

            index.Uid.Should().Be(indexName);
        }
Ejemplo n.º 4
0
        public void SetUp()
        {
            try
            {
                var client = new MeilisearchClient(_httpClient);
                var index  = client.GetIndex("Movies").Result;

                if (index == null)
                {
                    this.documentIndex = client.CreateIndex("Movies").Result;
                }
                else
                {
                    this.documentIndex = index;
                }

                var movies = new[]
                {
                    new Movie {
                        Id = "10", Name = "SuperMan"
                    },
                    new Movie {
                        Id = "11", Name = "SpiderMan"
                    },
                    new Movie {
                        Id = "12", Name = "IronMan"
                    },
                    new Movie {
                        Id = "13", Name = "SpiderMan"
                    },
                    new Movie {
                        Id = "14", Name = "IronMan"
                    },
                    new Movie {
                        Id = "15", Name = "SpiderMan"
                    },
                    new Movie {
                        Id = "16", Name = "IronMan"
                    }
                };
                var updateStatus = this.documentIndex.AddorUpdateDocuments(movies).Result;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }