Beispiel #1
0
        public void TestAllPosts()
        {
            PopularPostsDTO popularPostsDTO = new PopularPostsDTO();

            popularPostsDTO.PostsStatistics = GetFullDataPostStatisticsDTOs();

            IDictionary <string, double> result = calculatePopularPostsService.CalculatePopularPosts(popularPostsDTO, 2);

            Assert.Equal(0.4816487859966121, result.First().Value);
            Assert.Equal(HIGH_PROBABILITY_POST_ID, result.First().Key);

            Assert.Equal(0.25168454733672124, result.Last().Value);
            Assert.Equal(LOW_PROBABILITY_POST_ID, result.Last().Key);
        }
 public JsonResult Calculate([FromBody] PopularPostsDTO popularPostsDTO, int maxPosts)
 {
     return(Json(calculateSimilarPostsService.CalculatePopularPosts(popularPostsDTO, maxPosts)));
 }