protected override void Arrange() { base.Arrange(); this.imageBinary = new byte[0]; this.viewModel = new AddCheeseViewModel { Name = "Name", Description = "Description", Image = A.Fake<HttpPostedFileBase>() }; A.CallTo( () => this.ImageConverterService .ConvertToBinary(this.viewModel.Image.InputStream)).Returns(this.imageBinary); }
public ActionResult AddCheese(AddCheeseViewModel viewModel) { if (ModelState.IsValid == false) { return View("AddCheese", viewModel); } this.cheeseService.Register( new Cheese { Name = viewModel.Name, Description = viewModel.Description, Image = this.imageConverterService.ConvertToBinary(viewModel.Image.InputStream) }); this.TempData["SuccessMessage"] = @"Yay! Your cheese is legit!"; return RedirectToAction("AddCheese"); }
protected override void Arrange() { base.Arrange(); this.viewModel = new AddCheeseViewModel(); this.Sut.ModelState.AddModelError(string.Empty, string.Empty); }