public void InstagramPost_Roundtrips() { // Arrange JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.PostMessage.json"); InstagramPost expectedPost = new InstagramPost { Id = "1077852647225486162_194771465", Link = new Uri("https://instagram.com/p/3sFga24da/"), CreatedTime = _testTime, MediaType = "video", Location = new InstagramLocation { Id = 225623404, Name = "Equinox At The High Line", Latitude = 40.7437744, Longitude = -74.0068283 }, Images = new InstagramImages { Thumbnail = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/Thumbnail.jpg"), Width = 150, Height = 150, }, LowResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/LowRes.jpg"), Width = 320, Height = 320 }, StandardResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/StdRes.jpg"), Width = 640, Height = 640 } }, Videos = new InstagramVideos { LowBandwidth = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/LowBw.mp4"), Width = 480, Height = 270, }, LowResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/LowRes.mp4"), Width = 480, Height = 270 }, StandardResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/StdRes.mp4"), Width = 640, Height = 360 } }, Caption = new InstagramCaption { CreatedTime = _testTime, Id = "1077852735856538330", Text = "#handstand #drill #compilation", From = new InstagramUser { UserName = "******", ProfilePicture = new Uri("https://scontent.cdninstagram.com/userprofile.jpg"), FullName = "Some User", Id = "194771423" } }, User = new InstagramUser { Id = "194771423", FullName = "Some User", UserName = "******", ProfilePicture = new Uri("https://scontent.cdninstagram.com/userprofile.jpg"), } }; expectedPost.Tags.Add("compilation"); expectedPost.Tags.Add("handstand"); expectedPost.Tags.Add("drill"); // Act InstagramPost actualPost = data.ToObject<InstagramPost>(); // Assert string expectedJson = JsonConvert.SerializeObject(expectedPost); string actualJson = JsonConvert.SerializeObject(actualPost); Assert.Equal(expectedJson, actualJson); }
public void InstagramPost_Roundtrips() { // Arrange JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.PostMessage.json"); InstagramPost expectedPost = new InstagramPost { Id = "1077852647225486162_194771465", Link = new Uri("https://instagram.com/p/3sFga24da/"), CreatedTime = _testTime, MediaType = "video", Location = new InstagramLocation { Id = 225623404, Name = "Equinox At The High Line", Latitude = 40.7437744, Longitude = -74.0068283 }, Images = new InstagramImages { Thumbnail = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/Thumbnail.jpg"), Width = 150, Height = 150, }, LowResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/LowRes.jpg"), Width = 320, Height = 320 }, StandardResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/StdRes.jpg"), Width = 640, Height = 640 } }, Videos = new InstagramVideos { LowBandwidth = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/LowBw.mp4"), Width = 480, Height = 270, }, LowResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/LowRes.mp4"), Width = 480, Height = 270 }, StandardResolution = new InstagramMedia { Address = new Uri("https://scontent.cdninstagram.com/StdRes.mp4"), Width = 640, Height = 360 } }, Caption = new InstagramCaption { CreatedTime = _testTime, Id = "1077852735856538330", Text = "#handstand #drill #compilation", From = new InstagramUser { UserName = "******", ProfilePicture = new Uri("https://scontent.cdninstagram.com/userprofile.jpg"), FullName = "Some User", Id = "194771423" } }, User = new InstagramUser { Id = "194771423", FullName = "Some User", UserName = "******", ProfilePicture = new Uri("https://scontent.cdninstagram.com/userprofile.jpg"), } }; expectedPost.Tags.Add("compilation"); expectedPost.Tags.Add("handstand"); expectedPost.Tags.Add("drill"); // Act InstagramPost actualPost = data.ToObject <InstagramPost>(); // Assert string expectedJson = JsonConvert.SerializeObject(expectedPost); string actualJson = JsonConvert.SerializeObject(actualPost); Assert.Equal(expectedJson, actualJson); }