Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/Flickr.Net.Test/Entities/PhotoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,29 @@ public void PhotoDescriptionImplicitStringConversion()
string description = photo.Description;
Assert.Equal("A test description", description);
}

[Fact]
public void PhotoTagsAreDeserialized()
{
const string json = """{"photos":{"page":1,"pages":1,"perpage":10,"total":1,"photo":[{"id":"52931686549","owner":"192376927@N06","secret":"9b203d4894","server":"65535","farm":66,"title":"DSC04707","ispublic":1,"isfriend":0,"isfamily":0,"tags":"norge oslo sommer"}]},"stat":"ok"}""";

var result = FlickrConvert.DeserializeObject<FlickrResult<PagedPhotos>>(Encoding.UTF8.GetBytes(json));

Assert.NotNull(result);
Assert.False(result.HasError);
var photo = result.Content.Values[0];
Assert.Equal("norge oslo sommer", photo.Tags);
}

[Fact]
public void PhotoTagsIsNullWhenNotPresent()
{
const string json = """{"photos":{"page":1,"pages":1,"perpage":10,"total":1,"photo":[{"id":"52931686549","owner":"192376927@N06","secret":"9b203d4894","server":"65535","farm":66,"title":"DSC04707","ispublic":1,"isfriend":0,"isfamily":0}]},"stat":"ok"}""";

var result = FlickrConvert.DeserializeObject<FlickrResult<PagedPhotos>>(Encoding.UTF8.GetBytes(json));

Assert.NotNull(result);
var photo = result.Content.Values[0];
Assert.Null(photo.Tags);
}
}
7 changes: 7 additions & 0 deletions src/Flickr.Net/Entities/Photo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ public record Photo : UltraDeluxePhotoBase
/// </summary>
[JsonPropertyName("description")]
public Description Description { get; set; }

/// <summary>
/// A space-delimited list of all tags on the photo. Only populated
/// when PhotoSearchExtras.Tags is included in the search's Extras.
/// </summary>
[JsonPropertyName("tags")]
public string? Tags { get; set; }
}
Loading