Пример #1
0
        public static async Task <DBTextSummary> ProcessNewText(string inText)
        {
            wordInventorierService = new WordInventorierService();
            TextSummaryAndStructures textSummaryAndStructures = await wordInventorierService.Handle(inText);

            DBTextSummary insertData  = new DBTextSummary(textSummaryAndStructures);
            var           _insertData = insertData.ToBsonDocument();
            // var _insertData = JsonConvert.SerializeObject<DBTextSummary>(insertData);

            await dbCollection.InsertOneAsync(_insertData);

            // await dbCollection.InsertOneAsync(insertData);

            return(insertData);
        }
Пример #2
0
        public async Task CanHandleANewTextFromRetrievalUntilQueryResult(string inputStr, string textId, string mostFreq, string textType)
        {
            // wordInventoryService.Handle(inputStr, topN_inFreq = 50, topN_inFreqLongerthan_L = 50, Length_L = 6);
            List <Query> queries = new List <Query>();

            queries.Add(new Query(5, 0, 100));
            queries.Add(new Query(5, 4, 100));
            TextSummaryAndStructures res = await wordInventoryService.Handle(inputStr);

            Console.WriteLine(res.summary.idType);
            Console.WriteLine(textType);
            Console.WriteLine(res.summary.mostFrequentWord.key);



            Assert.True(res.summary.id == textId, "HTTP Get Request can be made, and the response is a text");
            Assert.True(res.summary.idType == textType, "HTTP Get Request can be made, and the response is a text");
            Assert.True(res.summary.mostFrequentWord.key == mostFreq, "HTTP Get Request can be made, and the response is a text");
            // Assert.True(false, "HTTP Get Request can be made, and the response is a text");

            Assert.That(async() => { return(1); }, Is.EqualTo(1).After(100));
        }