public GetThumbnail ( SafeUri fileUri, ThumbnailSize size ) : Pixbuf | ||
fileUri | SafeUri | |
size | ThumbnailSize | |
return | Pixbuf |
// Analysis disable once InconsistentNaming public void GetThumbnail_ReturnsNull_IfThumbnailCreationFails () { var fileSystem = new FileSystemMock (); fileSystem.SetFile (fileUri, fileMTime); thumbnailerMock.Setup (thumb => thumb.TryCreateThumbnail (largeThumbnailUri, ThumbnailSize.Large)).Returns (false); var thumbnailService = new ThumbnailService (xdgDirectoryService, thumbnailerFactory, fileSystem); var result = thumbnailService.GetThumbnail (fileUri, ThumbnailSize.Large); Assert.IsNull (result); }
// Analysis disable once InconsistentNaming public void GetThumbnail_CreatesPngAndReturnsPixbuf_IfPngIsMissing () { var fileSystem = new FileSystemMock (); fileSystem.SetFile (fileUri, fileMTime); thumbnailerMock.Setup (thumb => thumb.TryCreateThumbnail (largeThumbnailUri, ThumbnailSize.Large)) .Returns (true) .Callback (() => fileSystem.SetFile (largeThumbnailUri, 0, thumbnail)); var thumbnailService = new ThumbnailService (xdgDirectoryService, thumbnailerFactory, fileSystem); var result = thumbnailService.GetThumbnail (fileUri, ThumbnailSize.Large); Assert.IsNotNull (result); }
// Analysis disable once InconsistentNaming public void GetThumbnail_ReturnsNull_IfNoThumbnailerFound () { var fileSystem = new FileSystemMock (); var thumbnailerFactoryMock = new Mock<IThumbnailerFactory> (); var thumbnailService = new ThumbnailService (xdgDirectoryService, thumbnailerFactoryMock.Object, fileSystem); var result = thumbnailService.GetThumbnail (fileUri, ThumbnailSize.Large); Assert.IsNull (result); }
// Analysis disable once InconsistentNaming public void GetThumbnail_ReturnsPixbuf_IfValidPngExists () { var fileSystem = new FileSystemMock (); fileSystem.SetFile (fileUri, fileMTime); fileSystem.SetFile (largeThumbnailUri, 0, thumbnail); var thumbnailService = new ThumbnailService (xdgDirectoryService, thumbnailerFactory, fileSystem); var result = thumbnailService.GetThumbnail (fileUri, ThumbnailSize.Large); Assert.IsNotNull (result); }