public void TestEditIndex() { var indexConfig = new IndexConfig { IndexName = "ABC", MonitorFolder = MonitorFolder }; using var management = new IndexManagement(Config, Log); CollectionAssert.IsEmpty(management.GetIndexList().Result); Assert.IsFalse(management.EditIndex(indexConfig).Status.Success); Assert.IsTrue(management.AddIndex(indexConfig).Status.Success); CollectionAssert.AreEquivalent(new[] { indexConfig.ToString() }, management.GetIndexList().Result.Select(u => u.IndexConfig.ToString())); Assert.IsFalse(management.EditIndex(indexConfig with { IndexName = null }).Status.Success); Assert.IsFalse(management.EditIndex(indexConfig with { IndexName = "A".PadLeft(101, 'C') }).Status.Success); Assert.IsFalse(management.EditIndex(indexConfig with { Pk = Guid.NewGuid(), IndexName = "BBB", MonitorFolder = string.Empty }).Status.Success); Assert.IsFalse(management.EditIndex(indexConfig with { Pk = Guid.NewGuid(), IndexName = "BBB" }).Status.Success); Assert.IsFalse(management.EditIndex(indexConfig with { Pk = Guid.NewGuid(), IndexName = "BBB", MonitorFolder = "Dummy" }).Status.Success); CollectionAssert.AreEquivalent(new[] { indexConfig.ToString() }, management.GetIndexList().Result.Select(u => u.IndexConfig.ToString())); Assert.IsTrue(management.EditIndex(indexConfig with { IndexName = "BBB" }).Status.Success); CollectionAssert.AreEquivalent(new[] { (indexConfig with {
public async Task <FetchResult <bool> > EditIndex(IndexConfig indexConfig, [FromServices] IndexManagement indexManagement) { return(await Task.FromResult(indexManagement.EditIndex(indexConfig))); }