-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed StreamTweet MatchingRule.ID parsing. (#231)
* Fixed StreamTweet MatchingRule.ID parsing. * Removed unused usings.
- Loading branch information
Showing
3 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/LinqToTwitter6/LinqToTwitter.Tests/StreamTests/StreamContentTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using LinqToTwitter.Provider; | ||
using LinqToTwitter.Tests.Common; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Moq; | ||
|
||
namespace LinqToTwitter.Tests.StreamContentTests | ||
{ | ||
[TestClass] | ||
public class StreamContentTests | ||
{ | ||
Mock<ITwitterExecute> execMock = new(); | ||
|
||
public StreamContentTests() | ||
{ | ||
TestCulture.SetCulture(); | ||
} | ||
|
||
[TestMethod] | ||
public void ParseJson_WithTweetEntity_Succeeds() | ||
{ | ||
var content = new StreamContent(execMock.Object, TweetContent); | ||
|
||
(StreamTweet entity, StreamEntityType entityType) = content.ParseJson(TweetContent); | ||
|
||
Assert.IsNotNull(entity); | ||
Assert.AreEqual("1439984798332866573", entity.Tweet.ID); | ||
Assert.IsTrue(entity.Tweet.Text.StartsWith("Very")); | ||
Assert.AreEqual("1324201416731160579", entity.MatchingRules[0].ID); | ||
Assert.AreEqual("funny things", entity.MatchingRules[0].Tag); | ||
Assert.AreEqual(StreamEntityType.Tweet, entityType); | ||
} | ||
|
||
const string TweetContent = @"{ | ||
""data"": { | ||
""id"": ""1439984798332866573"", | ||
""text"": ""Very very true, Dev! ..😜😂💕\n#Dev https://t.co/cHFjan"" | ||
}, | ||
""matching_rules"": [ | ||
{ | ||
""id"": ""1324201416731160579"", | ||
""tag"": ""funny things"" | ||
} | ||
] | ||
}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters