UpnpPhoto GetPhoto(FSpotPhoto photo, Container parent) { UpnpPhoto upnp_photo = null; if (!photos_cache.ContainsKey(photo.Id)) { var resource_options = new ResourceOptions { ProtocolInfo = new ProtocolInfo(Protocols.HttpGet, MimeTypeHelper.GetMimeType(photo.DefaultVersion.Uri)) }; var resource_uri = new Uri(string.Format("{0}object?id={1}", prefix, upnp_photo.Id)); var photo_options = new PhotoOptions { Title = photo.Name, Rating = photo.Rating.ToString(), Description = photo.Description, Resources = new [] { new Resource(resource_uri, resource_options) } }; upnp_photo = new UpnpPhoto((id++).ToString(), parent.Id, photo_options); photos_cache.Add(photo.Id, upnp_photo); } else { upnp_photo = photos_cache [photo.Id]; } return(upnp_photo); }
public void PhotoInstantiation() { var options = new PhotoOptions(); SetPhotoOptions(options); var photo = new Photo("-1", "-1", options); AssertPhoto(photo, options); AssertPhoto(photo, photo.GetOptions()); }
public PhotoService(IOptions <PhotoOptions> options) { _options = options.Value; _random = new Random(); }
static void AssertPhoto(Photo photo, PhotoOptions options) { AssertImageItem(photo, options); Assert.IsTrue(photo.Albums.IsReadOnly); CollectionAssert.AreEqual(photo.Albums, options.Albums); }
static void SetPhotoOptions(PhotoOptions options) { SetImageItemOptions(options); options.Albums = new[] { "album" }; }