public void TestAddIndex()
        {
            var indexConfig = new IndexConfig
            {
                IndexName     = "ABC",
                MonitorFolder = MonitorFolder
            };

            using var management = new IndexManagement(Config, Log);
            CollectionAssert.IsEmpty(management.GetIndexList().Result);

            Assert.IsTrue(management.AddIndex(indexConfig).Status.Success);
            CollectionAssert.AreEquivalent(new[] { indexConfig.ToString() }, management.GetIndexList().Result.Select(u => u.IndexConfig.ToString()));

            Assert.IsFalse(management.AddIndex(indexConfig).Status.Success);
            Assert.IsFalse(management.AddIndex(indexConfig with {
                IndexName = null
            }).Status.Success);
            Assert.IsFalse(management.AddIndex(indexConfig with {
                IndexName = "BBB"
            }).Status.Success);
            Assert.IsFalse(management.AddIndex(indexConfig with {
                IndexName = "A".PadLeft(101, 'C')
            }).Status.Success);
            Assert.IsFalse(management.AddIndex(indexConfig with {
                Pk = Guid.NewGuid(), IndexName = "BBB", MonitorFolder = string.Empty
            }).Status.Success);
            Assert.IsFalse(management.AddIndex(indexConfig with {
                Pk = Guid.NewGuid(), IndexName = "BBB"
            }).Status.Success);
            Assert.IsFalse(management.AddIndex(indexConfig with {
                Pk = Guid.NewGuid(), IndexName = "BBB", MonitorFolder = "Dummy"
            }).Status.Success);
            CollectionAssert.AreEquivalent(new[] { indexConfig.ToString() }, management.GetIndexList().Result.Select(u => u.IndexConfig.ToString()));
        }
        public void TestConstructor_InitializeMaintainerPool()
        {
            var indexConfig = new IndexConfig
            {
                IndexName     = "ABC",
                MonitorFolder = MonitorFolder
            };

            using var management1 = new IndexManagement(Config, Log);
            CollectionAssert.IsEmpty(management1.GetIndexList().Result);

            management1.AddIndex(indexConfig);

            management1.Dispose();
            using var management2 = new IndexManagement(Config, Log);
            CollectionAssert.AreEquivalent(new[] { indexConfig.ToString() }, management2.GetIndexList().Result.Select(u => u.IndexConfig.ToString()));
        }
 public async Task <FetchResult <IndexStatusInfo[]> > GetIndexLists([FromServices] IndexManagement indexManagement)
 {
     return(await Task.FromResult(indexManagement.GetIndexList()));
 }