コード例 #1
0
        private static void Main(string[] args)
        {
            var docFileReader     = new DocFileReader("EnglishData");
            var indexCreator      = new IndexCreator(docFileReader);
            var hashInvertedIndex = new HashInvertedIndex(indexCreator.OrganizeDocsAndWords());
            var controller        = new Controller(new ConsoleView(), new Processor(hashInvertedIndex));

            controller.Run();
        }
        public void GetDocsContain_ShouldReturnEmptyList_WhenInputDoesNotExists()
        {
            //Arrange
            var docs = new HashSet <string>()
            {
                "57110"
            };
            var words = new Dictionary <string, HashSet <string> >()
            {
                { "found", docs }
            };

            _sut = new HashInvertedIndex(words);

            //Act
            var result = _sut.GetDocsContain("go");

            //Assert
            Assert.Equal(new HashSet <string>(), result);
        }
        public void GetDocsContainWord_ShouldSetCorrectDocs_WhenInputExists()
        {
            //Arrange
            var expected = new HashSet <string>()
            {
                "57110"
            };
            var words = new Dictionary <string, HashSet <string> >()
            {
                { "found", expected }
            };

            _sut = new HashInvertedIndex(words);

            //Act
            var result = _sut.GetDocsContain("found");

            //Assert
            Assert.Equal(expected, result);
        }