Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Extensions.Configuration;
- using Moq;
- using NUnit.Framework;
- using TradeCore.Analyzers.Keywords;
- using TradeCore.Model.Interfaces.Analyzers;
- namespace TradeCore.Analyzers.IntegrationTests
- {
- public class ParallelDotsApiTests
- {
- private IKeywordsAnalyzer _keywordsAnalyzer;
- private Mock<IConfiguration> _configurationMock;
- private Mock<IConfigurationSection> _configurationSectionMock;
- private const string ApiKey = "lasDoZerYi4MUtUkpooRvMfAqRzIwnpxtklN5sfbu70";
- [SetUp]
- public void Setup()
- {
- _configurationMock = new Mock<IConfiguration>();
- _configurationSectionMock = new Mock<IConfigurationSection>();
- _configurationSectionMock.Setup(s => s.Value).Returns(ApiKey);
- _configurationMock.Setup(c => c.GetSection(It.IsAny<string>())).Returns(_configurationSectionMock.Object);
- _keywordsAnalyzer = CreateParallelDotsKeywordsAnalyzer(_configurationMock.Object);
- }
- [Test]
- public void SuggestKeywords_RequestKeywordsByApi_GetKeywords()
- {
- var text =
- "Global warming set to exceed Paris agreement’s 1.5C limit by 2040s, according to draft UN report\', \'There is a tipping point’: UN warns climate change goals laid out in Paris accord are almost out of reach";
- var keywords = _keywordsAnalyzer.SuggestKeywords(text);
- Assert.True(keywords.Count > 0);
- }
- private IKeywordsAnalyzer CreateParallelDotsKeywordsAnalyzer(IConfiguration configuration)
- {
- return new ParallelDotsKeywordsAnalyzer(configuration);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement