public void InsertGpu_WithValidModel_ShouldBeInserted() { SetUp(); var gpu = new Gpu(); _gpuService.InsertGpu(gpu); Assert.Equal(gpu, _context.Gpus.First()); }
public IActionResult Create([Bind("Model,Manufacturer,Price,Memory")] Gpu gpu) { if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); if (image != null) { gpu.ImgUrl = _driveService.UploadFile(image); } else { gpu.ImgUrl = Constants.DEFAULT_GPU_IMG; } _service.InsertGpu(gpu); return(RedirectToAction(nameof(Index))); } return(View(gpu)); }