public void FindAndRegisterValidExtensionPoints_DoesNotRegisterInvalidExtensionPoints()
        {
            CreateExtensionPointsConfiguration(addInvalidExtensionPoints: true);
            ExtensionPointsConfigurationAnalyzer.FindAndRegisterValidExtensionPoints(extensionPointsConfiguration, logger);

            IParser parser = ExtensionPointsRepository.Instance.GetParserImplementation(".cs");

            Assert.IsNotNull(parser, "Default parser for '.cs' extension should be used!");
            Assert.AreEqual(parser.GetType().FullName, "Sando.Parser.SrcMLCSharpParser", "Invalid parser returned for '.cs' extension!");

            IWordSplitter wordSplitter = ExtensionPointsRepository.Instance.GetWordSplitterImplementation();

            Assert.IsNotNull(wordSplitter, "Default word splitter should be used!");
            Assert.AreEqual(wordSplitter.GetType().FullName, "Sando.Core.Tools.WordSplitter", "Invalid word splitter returned!");

            IResultsReorderer resultsReorderer = ExtensionPointsRepository.Instance.GetResultsReordererImplementation();

            Assert.IsNotNull(resultsReorderer, "Default results reorderer should be used!");
            Assert.AreEqual(resultsReorderer.GetType().FullName, "Sando.SearchEngine.SortByScoreResultsReorderer", "Invalid results reorderer returned!");

            string logFileContent = File.ReadAllText(logFilePath);

            Assert.IsTrue(logFileContent.Contains("Type cannot be found: Sando.NonExistingParser"), "Log file should contain information about errors occurred during the assembly loading!");
            Assert.IsTrue(logFileContent.Contains("Could not load file or assembly 'file:///" + pluginDirectory + "NonExistingParser.dll' or one of its dependencies"), "Log file should contain information about errors occurred during the assembly loading!");
            Assert.IsTrue(logFileContent.Contains("Could not load file or assembly 'file:///" + pluginDirectory + "NonExistingTestElement.dll' or one of its dependencies"), "Log file should contain information about errors occurred during the assembly loading!");
            Assert.IsTrue(logFileContent.Contains("Could not load file or assembly 'file:///" + pluginDirectory + "NonExistingWordSplitter.dll' or one of its dependencies"), "Log file should contain information about errors occurred during the assembly loading!");
            Assert.IsTrue(logFileContent.Contains("Type cannot be found: Sando.TestExtensionPoints.NonExistingResultsReorderer"), "Log file should contain information about errors occurred during the assembly loading!");
            Assert.IsTrue(logFileContent.Contains("Type cannot be found: Sando.TestExtensionPoints.NonExistingQueryWeightsSupplier"), "Log file should contain information about errors occurred during the assembly loading!");
            Assert.IsTrue(logFileContent.Contains("Type cannot be found: Sando.TestExtensionPoints.NonExistingQueryRewriter"), "Log file should contain information about errors occurred during the assembly loading!");
            Assert.IsTrue(logFileContent.Contains("Type cannot be found: Sando.TestExtensionPoints.NonExistingIndexFilterManager"), "Log file should contain information about errors occurred during the assembly loading!");
        }
        public void FindAndRegisterValidExtensionPoints_RemovesInvalidCustomWordSplitterConfiguration()
        {
            CreateExtensionPointsConfiguration(addInvalidWordSplitterConfiguration: true);
            ExtensionPointsConfigurationAnalyzer.FindAndRegisterValidExtensionPoints(extensionPointsConfiguration, logger);

            IWordSplitter wordSplitter = ExtensionPointsRepository.Instance.GetWordSplitterImplementation();

            Assert.IsNotNull(wordSplitter, "Default word splitter should x used!!");
            Assert.AreEqual(wordSplitter.GetType().FullName, "Sando.Core.Tools.WordSplitter", "Invalid word splitter returned!");

            string logFileContent = File.ReadAllText(logFilePath);

            Assert.IsTrue(logFileContent.Contains("Invalid word splitter configuration found - it will be omitted during registration process."), "Log file should contain information about removed invalid word splitter configuration!");
        }
        public void FindAndRegisterValidExtensionPoints_RegistersUsableCustomWordSplitter()
        {
            CreateExtensionPointsConfiguration(addValidWordSplitterConfiguration: true);
            ExtensionPointsConfigurationAnalyzer.FindAndRegisterValidExtensionPoints(extensionPointsConfiguration, logger);

            IWordSplitter wordSplitter = ExtensionPointsRepository.Instance.GetWordSplitterImplementation();

            Assert.IsNotNull(wordSplitter, "Word splitter should be registered!");
            Assert.AreEqual(wordSplitter.GetType().FullName, "Sando.TestExtensionPoints.TestWordSplitter", "Invalid word splitter returned!");

            string[] splittedWords = null;
            Assert.DoesNotThrow(() => splittedWords = wordSplitter.ExtractWords("FileName"));
            Assert.IsTrue(splittedWords != null && splittedWords.Length == 2, "Invalid results from ExtractWords method!");
            Assert.AreEqual(splittedWords[0], "File", "First splitted word is invalid!");
            Assert.AreEqual(splittedWords[1], "Name", "Second splitted word is invalid!");
        }