コード例 #1
0
        public void Handle_WhenEmptyWrapperIsSent_ReturnEmptyList()
        {
            var seacherLoader = new SearcherLoader(searchFightSectionWrapperMock.Object);
            var result        = seacherLoader.Handle();

            Assert.IsNotNull(result);
        }
コード例 #2
0
        public void Handle_WhenInvalidTypeIsTriedToBeInstantiated_ThrowInvalidOperationException()
        {
            var wrappedSearchers = new List <SearcherElementWrapper>
            {
                new SearcherElementWrapper {
                    Type = "InvalidNamespace.InvalidClass, InvalidAssembly"
                }
            };

            searchFightSectionWrapperMock.Setup(sfs => sfs.Searchers).Returns(wrappedSearchers);

            var searcherLoader = new SearcherLoader(searchFightSectionWrapperMock.Object);

            Assert.Throws <InvalidOperationException>(() => searcherLoader.Handle());
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter text: ");
            var searchText = Console.ReadLine();

            //if (args.Length < 2)
            if (string.IsNullOrEmpty(searchText) || searchText.Split(' ').Length < 2)
            {
                Console.WriteLine("You have to enter 2 words at least");
                return;
            }

            var configuration  = new SearchFightSectionWrapper(SearchFightSection.Configuration);
            var searcherLoader = new SearcherLoader(configuration);
            var searchProcess  = new SearchProcess(searcherLoader, new WinnerSearchCalculator());
            var processResult  = searchProcess.Run(searchText.Split(' ')).Result;

            Print(processResult);

            Console.ReadLine();
        }