public void FindAndRegisterValidExtensionPoints_RemovesInvalidCustomQueryWeightsSupplierConfiguration() { CreateExtensionPointsConfiguration(addInvalidQueryWeightsSupplierConfiguration: true); ExtensionPointsConfigurationAnalyzer.FindAndRegisterValidExtensionPoints(extensionPointsConfiguration, logger); IQueryWeightsSupplier queryWeightsSupplier = ExtensionPointsRepository.Instance.GetQueryWeightsSupplierImplementation(); Assert.IsNotNull(queryWeightsSupplier, "Default query weights supplier should be used!"); Assert.AreEqual(queryWeightsSupplier.GetType().FullName, "Sando.Indexer.Searching.QueryWeightsSupplier", "Invalid query weights supplier returned!"); string logFileContent = File.ReadAllText(logFilePath); Assert.IsTrue(logFileContent.Contains("Invalid query weights supplier configuration found - it will be omitted during registration process."), "Log file should contain information about removed invalid word splitter configuration!"); }
public void FindAndRegisterValidExtensionPoints_RegistersUsableCustomQueryWeightsSupplier() { CreateExtensionPointsConfiguration(addValidQueryWeightsSupplierConfiguration: true); ExtensionPointsConfigurationAnalyzer.FindAndRegisterValidExtensionPoints(extensionPointsConfiguration, logger); IQueryWeightsSupplier queryWeightsSupplier = ExtensionPointsRepository.Instance.GetQueryWeightsSupplierImplementation(); Assert.IsNotNull(queryWeightsSupplier, "Query weights supplier should be registered!"); Assert.AreEqual(queryWeightsSupplier.GetType().FullName, "Sando.TestExtensionPoints.TestQueryWeightsSupplier", "Invalid query weights supplier returned!"); Dictionary <string, float> weights = null; Assert.DoesNotThrow(() => weights = queryWeightsSupplier.GetQueryWeightsValues()); Assert.IsTrue(weights != null && weights.Count() == 2, "Invalid results from SetQueryWeightsValues method!"); Assert.AreEqual(weights["field1"], 2, "First weight is invalid!"); Assert.AreEqual(weights["field2"], 3, "Second weight is invalid!"); }