Пример #1
0
		public EntryThumbContract(EntryThumb entryThumb) {
			EntryType = entryThumb.EntryType;
			FileName = entryThumb.FileName;
			FileNameThumb = entryThumb.FileNameThumb;
			FileNameSmallThumb = entryThumb.FileNameSmallThumb;
			FileNameTinyThumb = entryThumb.FileNameTinyThumb;
			Id = entryThumb.Id;
			Mime = entryThumb.Mime;
			Version = entryThumb.Version;
		}
Пример #2
0
		public void Update_Image() {
			
			var updated = new TagContract(tag);
			using (var stream = TestImage()) {
				queries.Update(updated, new UploadedFileContract { Mime = MediaTypeNames.Image.Jpeg, Stream = stream });			
			}

			var thumb = new EntryThumb(tag, MediaTypeNames.Image.Jpeg);
			Assert.IsTrue(imagePersister.HasImage(thumb, ImageSize.Original), "Original image was saved");
			Assert.IsTrue(imagePersister.HasImage(thumb, ImageSize.SmallThumb), "Small thumbnail was saved");

			var archivedVersion = GetArchivedVersion(tag);
			Assert.IsNotNull(archivedVersion, "Archived version was created");
			Assert.AreEqual(TagEditableFields.Picture, archivedVersion.Diff.ChangedFields, "Changed fields");

		}
Пример #3
0
		public void Update_Picture() {

			var contract = CallUpdate(ResourceHelper.TestImage());

			var artistFromRepo = repository.Load(contract.Id);

			Assert.IsNotNull(artistFromRepo.Picture, "Picture");
			Assert.IsNotNull(artistFromRepo.Picture.Bytes, "Original bytes are saved");
			Assert.IsNull(artistFromRepo.Picture.Thumb250, "Thumb bytes not saved anymore");
			Assert.AreEqual(MediaTypeNames.Image.Jpeg, artistFromRepo.PictureMime, "Picture.Mime");

			var thumbData = new EntryThumb(artistFromRepo, artistFromRepo.PictureMime);
			Assert.IsFalse(imagePersister.HasImage(thumbData, ImageSize.Original), "Original file was not created"); // Original saved in Picture.Bytes
			Assert.IsTrue(imagePersister.HasImage(thumbData, ImageSize.Thumb), "Thumbnail file was saved");

			var archivedVersion = repository.List<ArchivedArtistVersion>().FirstOrDefault();

			Assert.IsNotNull(archivedVersion, "Archived version was created");
			Assert.AreEqual(ArtistEditableFields.Picture, archivedVersion.Diff.ChangedFields, "Changed fields");

		}
Пример #4
0
		public void Update_Image() {
			
			int id;
			using (var stream = TestImage()) {
				id = queries.UpdateSongList(songListContract, new UploadedFileContract { Mime = MediaTypeNames.Image.Jpeg, Stream = stream });			
			}

			var songList = repository.Load(id);

			var thumb = new EntryThumb(songList, MediaTypeNames.Image.Jpeg);
			Assert.IsTrue(imagePersister.HasImage(thumb, ImageSize.Original), "Original image was saved");
			Assert.IsTrue(imagePersister.HasImage(thumb, ImageSize.SmallThumb), "Thumbnail was saved");

		}