コード例 #1
0
        public async Task Can_Create_Get_and_Delete_FTS_Index()
        {
            var definition = new SearchIndexDefinition("test-index", "default");

            try
            {
                var createResult = await _clusterManager.CreateSearchIndexAsync(definition);

                Assert.IsTrue(createResult.Success);
                Assert.IsNull(createResult.Value);

                var getResult = await _clusterManager.GetSearchIndexDefinitionAsync(definition.IndexName);

                Assert.IsTrue(getResult.Success);
                Assert.IsNotEmpty(getResult.Value);

                // wait a second to give the index to register
                await Task.Delay(TimeSpan.FromSeconds(1));

                var countResult = await _clusterManager.GetSearchIndexDocumentCountAsync(definition.IndexName);

                Assert.IsTrue(countResult.Success);
                Assert.IsTrue(countResult.Value > 0);
            }
            finally
            {
                var deleteResult = await _clusterManager.DeleteSearchIndexAsync(definition.IndexName);

                Assert.IsTrue(deleteResult.Success);
            }
        }