-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some tests for TwitterExperimentalMetadata
- Loading branch information
1 parent
10414c4
commit 75fd4fd
Showing
2 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
MoEmbed.Core.Tests/Models/Metadata/TwitterExperimentalMetadataTest.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,33 @@ | ||
using MoEmbed.Providers; | ||
|
||
using System; | ||
|
||
using Xunit; | ||
|
||
namespace MoEmbed.Models.Metadata | ||
{ | ||
public class TwitterMetadataTest | ||
{ | ||
[Theory] | ||
[InlineData( | ||
463440424141459456L, | ||
"US Department of the Interior", | ||
"Sunsets don't get much better than this one over @GrandTetonNPS. #nature #sunset pic.twitter.com/YuKy2rcjyU" | ||
)] | ||
public void FetchAsyncTest(long tweetId, string expectedDisplayName, string expectedDescription) | ||
{ | ||
var uri = $"https://twitter.com/Interior/status/{tweetId}"; | ||
var target = new TwitterMetadataProvider().GetMetadata( | ||
new ConsumerRequest(new Uri(uri))); | ||
|
||
var data = target.FetchAsync( | ||
new RequestContext( | ||
new MetadataService(), | ||
new ConsumerRequest(new Uri(uri)))) | ||
.GetAwaiter().GetResult(); | ||
|
||
Assert.Equal(expectedDisplayName, data.Title); | ||
Assert.Equal(expectedDescription, data.Description); | ||
} | ||
} | ||
} |
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