public void SnackRepository_Should_Create_Snack() { // Arrange Snack snack = new Snack { Name = "Bounty", GewichtProEinheit = 12.34, SnackArtId = (int)SnackArtEnum.Schokolade }; // Act _snackRepo.Insert(snack); bool result = _snackRepo.SaveAll(); // Assert Assert.IsTrue(result); }
public ActionResult Create(SnackCreateVm snackVm) { if (!ModelState.IsValid) { return(View(snackVm)); } var snackDb = Mapper.Map <Snack>(snackVm); _snackRepo.Insert(snackDb); _snackRepo.SaveAll(); return(RedirectToAction("Index")); }