From 6a50b304627944e5f9c1b810fe32f9ed499528c0 Mon Sep 17 00:00:00 2001 From: azyobuzin Date: Mon, 3 Apr 2017 03:15:06 +0900 Subject: [PATCH] Return no TextPart if the length is zero --- .../CoreTweetSupplement.cs | 12 +- .../CoreTweetSupplement.Tests.csproj | 7 + test/CoreTweetSupplement.Tests/Tests.cs | 298 +++--------------- .../testdata/Status469054246503989248.json | 171 ++++++++++ .../testdata/Status469059084289708032.json | 89 ++++++ .../testdata/Status848569108350226434.json | 167 ++++++++++ 6 files changed, 493 insertions(+), 251 deletions(-) create mode 100644 test/CoreTweetSupplement.Tests/testdata/Status469054246503989248.json create mode 100644 test/CoreTweetSupplement.Tests/testdata/Status469059084289708032.json create mode 100644 test/CoreTweetSupplement.Tests/testdata/Status848569108350226434.json diff --git a/src/CoreTweetSupplement/CoreTweetSupplement.cs b/src/CoreTweetSupplement/CoreTweetSupplement.cs index 20fb66b..4d25ce7 100644 --- a/src/CoreTweetSupplement/CoreTweetSupplement.cs +++ b/src/CoreTweetSupplement/CoreTweetSupplement.cs @@ -139,6 +139,9 @@ private static string ToString(IList source, int start, int cou /// An whose elements are parts of . public static IEnumerable EnumerateTextParts(string text, Entities entities) { + if (text == null) + throw new ArgumentNullException(nameof(text)); + var chars = GetCodePoints(text); return EnumerateTextParts(chars, entities, 0, chars.Count); } @@ -153,6 +156,9 @@ public static IEnumerable EnumerateTextParts(string text, Entities ent /// An whose elements are parts of . public static IEnumerable EnumerateTextParts(string text, Entities entities, int startIndex, int endIndex) { + if (text == null) + throw new ArgumentNullException(nameof(text)); + var chars = GetCodePoints(text); if (startIndex < 0 || startIndex >= chars.Count) @@ -166,6 +172,8 @@ public static IEnumerable EnumerateTextParts(string text, Entities ent private static IEnumerable EnumerateTextParts(IList chars, Entities entities, int startIndex, int endIndex) { + if (startIndex == endIndex) yield break; + if (entities == null) { var text = ToString(chars, startIndex, endIndex - startIndex); @@ -185,7 +193,7 @@ private static IEnumerable EnumerateTextParts(IList c } var list = new LinkedList( - (entities.HashTags ?? Enumerable.Empty()) + (entities.HashTags ?? Enumerable.Empty()) .Select(e => new TextPart() { Type = TextPartType.Hashtag, @@ -196,7 +204,7 @@ private static IEnumerable EnumerateTextParts(IList c Entity = e }) .Concat( - (entities.Symbols ?? Enumerable.Empty()) + (entities.Symbols ?? Enumerable.Empty()) .Select(e => new TextPart() { Type = TextPartType.Cashtag, diff --git a/test/CoreTweetSupplement.Tests/CoreTweetSupplement.Tests.csproj b/test/CoreTweetSupplement.Tests/CoreTweetSupplement.Tests.csproj index 103eb9c..d1b1924 100644 --- a/test/CoreTweetSupplement.Tests/CoreTweetSupplement.Tests.csproj +++ b/test/CoreTweetSupplement.Tests/CoreTweetSupplement.Tests.csproj @@ -2,8 +2,14 @@ netcoreapp1.1 + CoreTweetSupplementTest + false + + + + @@ -15,6 +21,7 @@ + diff --git a/test/CoreTweetSupplement.Tests/Tests.cs b/test/CoreTweetSupplement.Tests/Tests.cs index f461cca..df56516 100644 --- a/test/CoreTweetSupplement.Tests/Tests.cs +++ b/test/CoreTweetSupplement.Tests/Tests.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using System.Reflection; using CoreTweet; @@ -14,6 +15,13 @@ private static object InvokeStatic(string methodName, params object[] paramet return (T)typeof(CoreTweetSupplement).GetTypeInfo().GetDeclaredMethod(methodName).Invoke(null, parameters); } + private static string LoadTestData(string name) + { + var resourceName = nameof(CoreTweetSupplementTest) + ".testdata." + name; + using (var reader = new StreamReader(typeof(Tests).GetTypeInfo().Assembly.GetManifestResourceStream(resourceName))) + return reader.ReadToEnd(); + } + [Fact] public void TestCharFromInt() { @@ -40,7 +48,7 @@ public void TestParseSource() } [Fact] - public void TestEnumerateTextParts() + public void TestEnumerateTextPartsPlain() { var array = CoreTweetSupplement.EnumerateTextParts("test", null).ToArray(); Assert.Equal(1, array.Length); @@ -48,263 +56,45 @@ public void TestEnumerateTextParts() Assert.Equal("test", array[0].RawText); Assert.Equal("test", array[0].Text); Assert.Null(array[0].Entity); - - #region Case 1 - const string case1 = @"{ - ""created_at"": ""Wed May 21 09:57:01 +0000 2014"", - ""id"": 469054246503989250, - ""id_str"": ""469054246503989248"", - ""text"": ""てすとtest𠮷野家 #𠮷野家 aa @azyobuzin_test http://t.co/KmtlVpXaUN"", - ""source"": ""ひゅいっ"", - ""truncated"": false, - ""in_reply_to_status_id"": null, - ""in_reply_to_status_id_str"": null, - ""in_reply_to_user_id"": null, - ""in_reply_to_user_id_str"": null, - ""in_reply_to_screen_name"": null, - ""user"": { - ""id"": 265093120, - ""id_str"": ""265093120"", - ""name"": ""ぺぺたろう(テストなーーう)"", - ""screen_name"": ""azyobuzin_test"", - ""location"": ""@azyobuzinの脳の一部"", - ""description"": ""@azyobuzinのテスト用アカウント"", - ""url"": ""https://t.co/Fmkl9K35Fu"", - ""entities"": { - ""url"": { - ""urls"": [ - { - ""url"": ""https://t.co/Fmkl9K35Fu"", - ""expanded_url"": ""https://twitter.com/azyobuzin"", - ""display_url"": ""twitter.com/azyobuzin"", - ""indices"": [ - 0, - 23 - ] - } - ] - }, - ""description"": { - ""urls"": [] - } - }, - ""protected"": false, - ""followers_count"": 6, - ""friends_count"": 2, - ""listed_count"": 1, - ""created_at"": ""Sun Mar 13 00:52:42 +0000 2011"", - ""favourites_count"": 14, - ""utc_offset"": 32400, - ""time_zone"": ""Tokyo"", - ""geo_enabled"": true, - ""verified"": false, - ""statuses_count"": 84, - ""lang"": ""ja"", - ""contributors_enabled"": false, - ""is_translator"": false, - ""is_translation_enabled"": false, - ""profile_background_color"": ""C0DEED"", - ""profile_background_image_url"": ""http://abs.twimg.com/images/themes/theme1/bg.png"", - ""profile_background_image_url_https"": ""https://abs.twimg.com/images/themes/theme1/bg.png"", - ""profile_background_tile"": false, - ""profile_image_url"": ""http://abs.twimg.com/sticky/default_profile_images/default_profile_5_normal.png"", - ""profile_image_url_https"": ""https://abs.twimg.com/sticky/default_profile_images/default_profile_5_normal.png"", - ""profile_link_color"": ""0084B4"", - ""profile_sidebar_border_color"": ""C0DEED"", - ""profile_sidebar_fill_color"": ""DDEEF6"", - ""profile_text_color"": ""333333"", - ""profile_use_background_image"": true, - ""default_profile"": true, - ""default_profile_image"": true, - ""following"": true, - ""follow_request_sent"": false, - ""notifications"": false - }, - ""geo"": null, - ""coordinates"": null, - ""place"": null, - ""contributors"": null, - ""retweet_count"": 0, - ""favorite_count"": 0, - ""entities"": { - ""hashtags"": [], - ""symbols"": [], - ""urls"": [], - ""user_mentions"": [ - { - ""screen_name"": ""azyobuzin_test"", - ""name"": ""ぺぺたろう(テストなーーう)"", - ""id"": 265093120, - ""id_str"": ""265093120"", - ""indices"": [ - 19, - 34 - ] - } - ], - ""media"": [ - { - ""id"": 469054246201991200, - ""id_str"": ""469054246201991168"", - ""indices"": [ - 35, - 57 - ], - ""media_url"": ""http://pbs.twimg.com/media/BoJqWg1CIAAn2KB.png"", - ""media_url_https"": ""https://pbs.twimg.com/media/BoJqWg1CIAAn2KB.png"", - ""url"": ""http://t.co/KmtlVpXaUN"", - ""display_url"": ""pic.twitter.com/KmtlVpXaUN"", - ""expanded_url"": ""http://twitter.com/azyobuzin_test/status/469054246503989248/photo/1"", - ""type"": ""photo"", - ""sizes"": { - ""large"": { - ""w"": 616, - ""h"": 485, - ""resize"": ""fit"" - }, - ""thumb"": { - ""w"": 150, - ""h"": 150, - ""resize"": ""crop"" - }, - ""small"": { - ""w"": 339, - ""h"": 267, - ""resize"": ""fit"" - }, - ""medium"": { - ""w"": 599, - ""h"": 472, - ""resize"": ""fit"" - } } - } - ] - }, - ""favorited"": false, - ""retweeted"": false, - ""possibly_sensitive"": false, - ""lang"": ""ja"" -}"; - #endregion - array = JsonConvert.DeserializeObject(case1).EnumerateTextParts().ToArray(); - Assert.Equal(4, array.Length); + [Fact] + public void TestEnumerateTextPartsNonBmp() + { + var json = LoadTestData("Status469054246503989248.json"); + var array = JsonConvert.DeserializeObject(json).EnumerateTextParts().ToArray(); + Assert.Equal(6, array.Length); Assert.Equal(TextPartType.Plain, array[0].Type); - Assert.Equal("てすとtest𠮷野家 #𠮷野家 aa ", array[0].RawText); - Assert.Equal("てすとtest𠮷野家 #𠮷野家 aa ", array[0].Text); + Assert.Equal("てすとtest𠮷野家 ", array[0].RawText); + Assert.Equal("てすとtest𠮷野家 ", array[0].Text); Assert.Null(array[0].Entity); - Assert.Equal(TextPartType.UserMention, array[1].Type); - Assert.Equal("@azyobuzin_test", array[1].RawText); - Assert.Equal("@azyobuzin_test", array[1].Text); + Assert.Equal(TextPartType.Hashtag, array[1].Type); + Assert.Equal("#𠮷野家", array[1].RawText); + Assert.Equal("#𠮷野家", array[1].Text); Assert.NotNull(array[1].Entity); Assert.Equal(TextPartType.Plain, array[2].Type); - Assert.Equal(" ", array[2].RawText); - Assert.Equal(" ", array[2].Text); + Assert.Equal(" aa ", array[2].RawText); + Assert.Equal(" aa ", array[2].Text); Assert.Null(array[2].Entity); - Assert.Equal(TextPartType.Url, array[3].Type); - Assert.Equal("http://t.co/KmtlVpXaUN", array[3].RawText); - Assert.Equal("pic.twitter.com/KmtlVpXaUN", array[3].Text); + Assert.Equal(TextPartType.UserMention, array[3].Type); + Assert.Equal("@azyobuzin_test", array[3].RawText); + Assert.Equal("@azyobuzin_test", array[3].Text); Assert.NotNull(array[3].Entity); + Assert.Equal(TextPartType.Plain, array[4].Type); + Assert.Equal(" ", array[4].RawText); + Assert.Equal(" ", array[4].Text); + Assert.Null(array[4].Entity); + Assert.Equal(TextPartType.Url, array[5].Type); + Assert.Equal("http://t.co/KmtlVpXaUN", array[5].RawText); + Assert.Equal("pic.twitter.com/KmtlVpXaUN", array[5].Text); + Assert.NotNull(array[5].Entity); + } - #region Case 2 - const string case2 = @"{ - ""created_at"": ""Wed May 21 10:16:15 +0000 2014"", - ""id"": 469059084289708000, - ""id_str"": ""469059084289708032"", - ""text"": ""ってって #test &<てすと>&&amp;"", - ""source"": ""ひゅいっ"", - ""truncated"": false, - ""in_reply_to_status_id"": null, - ""in_reply_to_status_id_str"": null, - ""in_reply_to_user_id"": null, - ""in_reply_to_user_id_str"": null, - ""in_reply_to_screen_name"": null, - ""user"": { - ""id"": 265093120, - ""id_str"": ""265093120"", - ""name"": ""ぺぺたろう(テストなーーう)"", - ""screen_name"": ""azyobuzin_test"", - ""location"": ""@azyobuzinの脳の一部"", - ""description"": ""@azyobuzinのテスト用アカウント"", - ""url"": ""https://t.co/Fmkl9K35Fu"", - ""entities"": { - ""url"": { - ""urls"": [ - { - ""url"": ""https://t.co/Fmkl9K35Fu"", - ""expanded_url"": ""https://twitter.com/azyobuzin"", - ""display_url"": ""twitter.com/azyobuzin"", - ""indices"": [ - 0, - 23 - ] - } - ] - }, - ""description"": { - ""urls"": [] - } - }, - ""protected"": false, - ""followers_count"": 6, - ""friends_count"": 2, - ""listed_count"": 1, - ""created_at"": ""Sun Mar 13 00:52:42 +0000 2011"", - ""favourites_count"": 14, - ""utc_offset"": 32400, - ""time_zone"": ""Tokyo"", - ""geo_enabled"": true, - ""verified"": false, - ""statuses_count"": 85, - ""lang"": ""ja"", - ""contributors_enabled"": false, - ""is_translator"": false, - ""is_translation_enabled"": false, - ""profile_background_color"": ""C0DEED"", - ""profile_background_image_url"": ""http://abs.twimg.com/images/themes/theme1/bg.png"", - ""profile_background_image_url_https"": ""https://abs.twimg.com/images/themes/theme1/bg.png"", - ""profile_background_tile"": false, - ""profile_image_url"": ""http://abs.twimg.com/sticky/default_profile_images/default_profile_5_normal.png"", - ""profile_image_url_https"": ""https://abs.twimg.com/sticky/default_profile_images/default_profile_5_normal.png"", - ""profile_link_color"": ""0084B4"", - ""profile_sidebar_border_color"": ""C0DEED"", - ""profile_sidebar_fill_color"": ""DDEEF6"", - ""profile_text_color"": ""333333"", - ""profile_use_background_image"": true, - ""default_profile"": true, - ""default_profile_image"": true, - ""following"": true, - ""follow_request_sent"": false, - ""notifications"": false - }, - ""geo"": null, - ""coordinates"": null, - ""place"": null, - ""contributors"": null, - ""retweet_count"": 0, - ""favorite_count"": 0, - ""entities"": { - ""hashtags"": [ - { - ""text"": ""test"", - ""indices"": [ - 5, - 10 - ] - } - ], - ""symbols"": [], - ""urls"": [], - ""user_mentions"": [] - }, - ""favorited"": false, - ""retweeted"": false, - ""lang"": ""ja"" -}"; - #endregion - - array = JsonConvert.DeserializeObject(case2).EnumerateTextParts().ToArray(); + [Fact] + public void TestEnumerateTextPartsCharReference() + { + var json = LoadTestData("Status469059084289708032.json"); + var array = JsonConvert.DeserializeObject(json).EnumerateTextParts().ToArray(); Assert.Equal(3, array.Length); Assert.Equal(TextPartType.Plain, array[0].Type); Assert.Equal("ってって ", array[0].RawText); @@ -370,5 +160,15 @@ public void TestAlternativeProfileImageUri() ) ); } + + [Fact] + public void TestGetExtendedTweetElementsEmptyTweetText() + { + var json = LoadTestData("Status848569108350226434.json"); + var tweetInfo = JsonConvert.DeserializeObject(json).GetExtendedTweetElements(); + Assert.Equal(1, tweetInfo.HiddenPrefix.Length); + Assert.Equal(0, tweetInfo.TweetText.Length); + Assert.Equal(1, tweetInfo.HiddenSuffix.Length); + } } } diff --git a/test/CoreTweetSupplement.Tests/testdata/Status469054246503989248.json b/test/CoreTweetSupplement.Tests/testdata/Status469054246503989248.json new file mode 100644 index 0000000..cf40dfd --- /dev/null +++ b/test/CoreTweetSupplement.Tests/testdata/Status469054246503989248.json @@ -0,0 +1,171 @@ +{ + "created_at": "Wed May 21 09:57:01 +0000 2014", + "id": 469054246503989248, + "id_str": "469054246503989248", + "text": "\u3066\u3059\u3068test\ud842\udfb7\u91ce\u5bb6 #\ud842\udfb7\u91ce\u5bb6 aa @azyobuzin_test http:\/\/t.co\/KmtlVpXaUN", + "truncated": false, + "entities": { + "hashtags": [ + { + "text": "\ud842\udfb7\u91ce\u5bb6", + "indices": [ 11, 15 ] + } + ], + "symbols": [], + "user_mentions": [ + { + "screen_name": "azyobuzin_test", + "name": "\u307a\u307a\u305f\u308d\u3046\uff08\u30c6\u30b9\u30c8\u306a\u30fc\u30fc\u3046\uff09", + "id": 265093120, + "id_str": "265093120", + "indices": [ 19, 34 ] + } + ], + "urls": [], + "media": [ + { + "id": 469054246201991168, + "id_str": "469054246201991168", + "indices": [ 35, 57 ], + "media_url": "http:\/\/pbs.twimg.com\/media\/BoJqWg1CIAAn2KB.png", + "media_url_https": "https:\/\/pbs.twimg.com\/media\/BoJqWg1CIAAn2KB.png", + "url": "http:\/\/t.co\/KmtlVpXaUN", + "display_url": "pic.twitter.com\/KmtlVpXaUN", + "expanded_url": "https:\/\/twitter.com\/azyobuzin_test\/status\/469054246503989248\/photo\/1", + "type": "photo", + "sizes": { + "thumb": { + "w": 150, + "h": 150, + "resize": "crop" + }, + "medium": { + "w": 600, + "h": 472, + "resize": "fit" + }, + "large": { + "w": 616, + "h": 485, + "resize": "fit" + }, + "small": { + "w": 340, + "h": 268, + "resize": "fit" + } + } + } + ] + }, + "extended_entities": { + "media": [ + { + "id": 469054246201991168, + "id_str": "469054246201991168", + "indices": [ 35, 57 ], + "media_url": "http:\/\/pbs.twimg.com\/media\/BoJqWg1CIAAn2KB.png", + "media_url_https": "https:\/\/pbs.twimg.com\/media\/BoJqWg1CIAAn2KB.png", + "url": "http:\/\/t.co\/KmtlVpXaUN", + "display_url": "pic.twitter.com\/KmtlVpXaUN", + "expanded_url": "https:\/\/twitter.com\/azyobuzin_test\/status\/469054246503989248\/photo\/1", + "type": "photo", + "sizes": { + "thumb": { + "w": 150, + "h": 150, + "resize": "crop" + }, + "medium": { + "w": 600, + "h": 472, + "resize": "fit" + }, + "large": { + "w": 616, + "h": 485, + "resize": "fit" + }, + "small": { + "w": 340, + "h": 268, + "resize": "fit" + } + } + } + ] + }, + "source": "\u003ca href=\"http:\/\/azyobuzi.net\/\" rel=\"nofollow\"\u003e\u3072\u3085\u3044\u3063\u003c\/a\u003e", + "in_reply_to_status_id": null, + "in_reply_to_status_id_str": null, + "in_reply_to_user_id": null, + "in_reply_to_user_id_str": null, + "in_reply_to_screen_name": null, + "user": { + "id": 265093120, + "id_str": "265093120", + "name": "\u307a\u307a\u305f\u308d\u3046\uff08\u30c6\u30b9\u30c8\u306a\u30fc\u30fc\u3046\uff09", + "screen_name": "azyobuzin_test", + "location": "@azyobuzin\u306e\u8133\u306e\u4e00\u90e8", + "description": "@azyobuzin\u306e\u30c6\u30b9\u30c8\u7528\u30a2\u30ab\u30a6\u30f3\u30c8", + "url": "https:\/\/t.co\/Fmkl9K35Fu", + "entities": { + "url": { + "urls": [ + { + "url": "https:\/\/t.co\/Fmkl9K35Fu", + "expanded_url": "https:\/\/twitter.com\/azyobuzin", + "display_url": "twitter.com\/azyobuzin", + "indices": [ 0, 23 ] + } + ] + }, + "description": { "urls": [] } + }, + "protected": false, + "followers_count": 4, + "friends_count": 1, + "listed_count": 1, + "created_at": "Sun Mar 13 00:52:42 +0000 2011", + "favourites_count": 16, + "utc_offset": 32400, + "time_zone": "Tokyo", + "geo_enabled": true, + "verified": false, + "statuses_count": 106, + "lang": "ja", + "contributors_enabled": false, + "is_translator": false, + "is_translation_enabled": false, + "profile_background_color": "C0DEED", + "profile_background_image_url": "http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", + "profile_background_image_url_https": "https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", + "profile_background_tile": false, + "profile_image_url": "http:\/\/abs.twimg.com\/sticky\/default_profile_images\/default_profile_normal.png", + "profile_image_url_https": "https:\/\/abs.twimg.com\/sticky\/default_profile_images\/default_profile_normal.png", + "profile_link_color": "1DA1F2", + "profile_sidebar_border_color": "C0DEED", + "profile_sidebar_fill_color": "DDEEF6", + "profile_text_color": "333333", + "profile_use_background_image": true, + "has_extended_profile": false, + "default_profile": true, + "default_profile_image": true, + "following": true, + "follow_request_sent": false, + "notifications": false, + "translator_type": "none" + }, + "geo": null, + "coordinates": null, + "place": null, + "contributors": null, + "is_quote_status": false, + "retweet_count": 0, + "favorite_count": 0, + "favorited": false, + "retweeted": false, + "possibly_sensitive": false, + "possibly_sensitive_appealable": false, + "lang": "ja" +} diff --git a/test/CoreTweetSupplement.Tests/testdata/Status469059084289708032.json b/test/CoreTweetSupplement.Tests/testdata/Status469059084289708032.json new file mode 100644 index 0000000..2a8a767 --- /dev/null +++ b/test/CoreTweetSupplement.Tests/testdata/Status469059084289708032.json @@ -0,0 +1,89 @@ +{ + "created_at": "Wed May 21 10:16:15 +0000 2014", + "id": 469059084289708032, + "id_str": "469059084289708032", + "text": "ってって #test &<てすと>&&amp;", + "truncated": false, + "entities": { + "hashtags": [ + { + "text": "test", + "indices": [ 5, 10 ] + } + ], + "symbols": [], + "user_mentions": [], + "urls": [] + }, + "source": "ひゅいっ", + "in_reply_to_status_id": null, + "in_reply_to_status_id_str": null, + "in_reply_to_user_id": null, + "in_reply_to_user_id_str": null, + "in_reply_to_screen_name": null, + "user": { + "id": 265093120, + "id_str": "265093120", + "name": "ぺぺたろう(テストなーーう)", + "screen_name": "azyobuzin_test", + "location": "@azyobuzinの脳の一部", + "description": "@azyobuzinのテスト用アカウント", + "url": "https://t.co/Fmkl9K35Fu", + "entities": { + "url": { + "urls": [ + { + "url": "https://t.co/Fmkl9K35Fu", + "expanded_url": "https://twitter.com/azyobuzin", + "display_url": "twitter.com/azyobuzin", + "indices": [ 0, 23 ] + } + ] + }, + "description": { "urls": [] } + }, + "protected": false, + "followers_count": 4, + "friends_count": 1, + "listed_count": 1, + "created_at": "Sun Mar 13 00:52:42 +0000 2011", + "favourites_count": 16, + "utc_offset": 32400, + "time_zone": "Tokyo", + "geo_enabled": true, + "verified": false, + "statuses_count": 106, + "lang": "ja", + "contributors_enabled": false, + "is_translator": false, + "is_translation_enabled": false, + "profile_background_color": "C0DEED", + "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", + "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", + "profile_background_tile": false, + "profile_image_url": "http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png", + "profile_image_url_https": "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png", + "profile_link_color": "1DA1F2", + "profile_sidebar_border_color": "C0DEED", + "profile_sidebar_fill_color": "DDEEF6", + "profile_text_color": "333333", + "profile_use_background_image": true, + "has_extended_profile": false, + "default_profile": true, + "default_profile_image": true, + "following": true, + "follow_request_sent": false, + "notifications": false, + "translator_type": "none" + }, + "geo": null, + "coordinates": null, + "place": null, + "contributors": null, + "is_quote_status": false, + "retweet_count": 0, + "favorite_count": 0, + "favorited": false, + "retweeted": false, + "lang": "ja" +} diff --git a/test/CoreTweetSupplement.Tests/testdata/Status848569108350226434.json b/test/CoreTweetSupplement.Tests/testdata/Status848569108350226434.json new file mode 100644 index 0000000..2b94205 --- /dev/null +++ b/test/CoreTweetSupplement.Tests/testdata/Status848569108350226434.json @@ -0,0 +1,167 @@ +{ + "created_at": "Sun Apr 02 16:13:35 +0000 2017", + "id": 848569108350226434, + "id_str": "848569108350226434", + "full_text": "@azyobuzin_test https://t.co/WstAHL85DJ", + "truncated": false, + "display_text_range": [ 16, 16 ], + "entities": { + "hashtags": [], + "symbols": [], + "user_mentions": [ + { + "screen_name": "azyobuzin_test", + "name": "ぺぺたろう(テストなーーう)", + "id": 265093120, + "id_str": "265093120", + "indices": [ 0, 15 ] + } + ], + "urls": [], + "media": [ + { + "id": 848569081796018176, + "id_str": "848569081796018176", + "indices": [ 17, 40 ], + "media_url": "http://pbs.twimg.com/media/C8a5FX_UwAAGvQf.jpg", + "media_url_https": "https://pbs.twimg.com/media/C8a5FX_UwAAGvQf.jpg", + "url": "https://t.co/WstAHL85DJ", + "display_url": "pic.twitter.com/WstAHL85DJ", + "expanded_url": "https://twitter.com/azyobuzin_2/status/848569108350226434/photo/1", + "type": "photo", + "sizes": { + "medium": { + "w": 1200, + "h": 750, + "resize": "fit" + }, + "thumb": { + "w": 150, + "h": 150, + "resize": "crop" + }, + "small": { + "w": 680, + "h": 425, + "resize": "fit" + }, + "large": { + "w": 1440, + "h": 900, + "resize": "fit" + } + } + } + ] + }, + "extended_entities": { + "media": [ + { + "id": 848569081796018176, + "id_str": "848569081796018176", + "indices": [ 17, 40 ], + "media_url": "http://pbs.twimg.com/media/C8a5FX_UwAAGvQf.jpg", + "media_url_https": "https://pbs.twimg.com/media/C8a5FX_UwAAGvQf.jpg", + "url": "https://t.co/WstAHL85DJ", + "display_url": "pic.twitter.com/WstAHL85DJ", + "expanded_url": "https://twitter.com/azyobuzin_2/status/848569108350226434/photo/1", + "type": "photo", + "sizes": { + "medium": { + "w": 1200, + "h": 750, + "resize": "fit" + }, + "thumb": { + "w": 150, + "h": 150, + "resize": "crop" + }, + "small": { + "w": 680, + "h": 425, + "resize": "fit" + }, + "large": { + "w": 1440, + "h": 900, + "resize": "fit" + } + } + } + ] + }, + "source": "TweetDeck", + "in_reply_to_status_id": 848568999231148033, + "in_reply_to_status_id_str": "848568999231148033", + "in_reply_to_user_id": 265093120, + "in_reply_to_user_id_str": "265093120", + "in_reply_to_screen_name": "azyobuzin_test", + "user": { + "id": 359512253, + "id_str": "359512253", + "name": "跳ねる azyobuzin", + "screen_name": "azyobuzin_2", + "location": "", + "description": "規制系紳士\nPart1 ← @azyobuzin\r\nPart3 → @azy0buz1n", + "url": "http://t.co/xJQcGTztVe", + "entities": { + "url": { + "urls": [ + { + "url": "http://t.co/xJQcGTztVe", + "expanded_url": "https://twitter.com/azyobuzin", + "display_url": "twitter.com/azyobuzin", + "indices": [ 0, 22 ] + } + ] + }, + "description": { "urls": [] } + }, + "protected": false, + "followers_count": 17, + "friends_count": 16, + "listed_count": 2, + "created_at": "Sun Aug 21 18:25:50 +0000 2011", + "favourites_count": 15, + "utc_offset": 32400, + "time_zone": "Tokyo", + "geo_enabled": true, + "verified": false, + "statuses_count": 428, + "lang": "ja", + "contributors_enabled": false, + "is_translator": false, + "is_translation_enabled": false, + "profile_background_color": "C0DEED", + "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", + "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", + "profile_background_tile": false, + "profile_image_url": "http://pbs.twimg.com/profile_images/1510612427/bakeneko_normal.png", + "profile_image_url_https": "https://pbs.twimg.com/profile_images/1510612427/bakeneko_normal.png", + "profile_link_color": "1DA1F2", + "profile_sidebar_border_color": "C0DEED", + "profile_sidebar_fill_color": "DDEEF6", + "profile_text_color": "333333", + "profile_use_background_image": true, + "has_extended_profile": false, + "default_profile": true, + "default_profile_image": false, + "following": true, + "follow_request_sent": false, + "notifications": false, + "translator_type": "none" + }, + "geo": null, + "coordinates": null, + "place": null, + "contributors": null, + "is_quote_status": false, + "retweet_count": 0, + "favorite_count": 0, + "favorited": false, + "retweeted": false, + "possibly_sensitive": false, + "possibly_sensitive_appealable": false, + "lang": "und" +}