public async Task IncludeMainPhoto_NoMainPhoto_SetMainPhotoToNull() { _mainPhoto = null; await _service.IncludeMainPhoto(_mainPhotoUploadable, (int)EntityTypes.Film); _mainPhotoUploadable.MainPhoto.Should().BeNull(); }
private async Task <Unit> RemoveFromDatabaseAsync(PhotoEntity photo) { await _photoRepo.RemoveAsync(photo); if (await _photoRepo.SaveAllAsync()) { return(await Task.FromResult(Unit.Value)); } throw new DatabaseException("Error occured while updating database."); }
public async Task Upload_NoMainPhoto_SetPhotoAsMain() { _mainPhoto = null; await _service.Upload(_photoForCreation); _cloudUploadService.Verify(x => x.UploadPhotoToCloud(_photoForCreation.File), Times.Once); _photo.IsMain.Should().BeTrue(); _uow.Verify(x => x.Repository <Domain.Entities.Photo>().Add(_photo), Times.Once); _uow.Verify(x => x.SaveAsync(), Times.Once); }
private void InitializeObjects() { _service = new PhotoService(_cloudUploadService.Object, _mapper.Object, _uow.Object); _photoForCreation = new PhotoForCreationDto { File = new Mock <IFormFile>().Object, Description = "description", EntityTypeId = (int)EntityTypes.Film, EntityId = 1 }; _uploadResult = new PhotoCloudUploadResult { PublicId = "PublicId", Url = "Url" }; _photo = new Domain.Entities.Photo(); _mainPhoto = new Domain.Entities.Photo(); _photos = new List <Domain.Entities.Photo>(); _photosForDetailed = new List <PhotoForDetailedDto> { new PhotoForDetailedDto { }, new PhotoForDetailedDto { } }; _mainPhotoUploadable = new MainPhotoUploadable { Id = 1 }; }