public void Get_ShouldReturnEntity() { //Arrange ResetDataBase(); ContentContentTypesBL contentContentTypesBL = DI.Resolve <ContentContentTypesBL>(); //Act ContentContentType contentContentType = contentContentTypesBL.Get("image/png"); //Assert Assert.That(contentContentType, !Is.Null); }
private void ProcessPhotos(ProductCreateOrEditViewModel model, Product target) { ProductPhotoViewModel mainPhotoViewModel = model.ProductPhotoViewModels.SingleOrDefault(x => x.IsMain); target.Photos.ForEach(photo => { photo.IsMain = mainPhotoViewModel != null && photo.Id == mainPhotoViewModel.Id; }); foreach (HttpPostedFileBase postedFile in model.PostedProductPhotos) { if (postedFile != null) { ProductPhoto photo = new ProductPhoto { Data = new byte[postedFile.InputStream.Length], ContentContentType = _contentContentTypesBL.Get(postedFile.ContentType), FileName = postedFile.FileName, IsMain = false }; postedFile.InputStream.Read(photo.Data, 0, photo.Data.Length); target.Photos.Add(photo); } } }