public void Test_Classifier_With_Many_Tweets_When_All_Tweets_Are_Positive() { var initSentences = new[] { new Sentence("hate", WordCategory.Negative), new Sentence("love", WordCategory.Positive) }; var learningService = LearningService.WithCacheService(new CacheServiceForTests()).WithLearner(new TweetLearner()).WithSentences(initSentences).Build(); var service = new BayesAnalysisService(learningService, new TweetClassifier()); var testResult = service.Analyze(Enumerable.Range(0, 10000).Select(x => new Tweet { Text = "love and sun" }).ToList()); testResult.IsSuccess.Should().BeTrue(); testResult.Value.First().Sentiment.Should().Be(WordCategory.Positive); }
public void Test_Classifier_When_All_Tweets_Are_Negative() { var initSentences = new[] { new Sentence("hate", WordCategory.Negative), new Sentence("love", WordCategory.Positive) }; var learningService = LearningService.WithCacheService(new CacheServiceForTests()).WithLearner(new TweetLearner()).WithSentences(initSentences).Build(); var service = new BayesAnalysisService(learningService, new TweetClassifier()); var testResult = service.Analyze(new List <Tweet> { new Tweet { Text = "f**k and suck" } }); testResult.IsSuccess.Should().BeTrue(); testResult.Value.First().Sentiment.Should().Be(WordCategory.Negative); }