public async Task <IActionResult> Create([Bind("GenreId,Name")] Genre genre) { if (ModelState.IsValid) { await _genreService.AddAndSave(genre); return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public async Task AddTest() { var fakeRepository = Mock.Of <IGenresRepository>(); var genreService = new GenreService(fakeRepository); var genre = new Genre() { Genre_name = "test genre" }; await genreService.AddAndSave(genre); }
public async Task NullNameAddTest() { var fakeRepository = Mock.Of <IGenresRepository>(); var genreService = new GenreService(fakeRepository); String name = ""; Assert.NotNull(name); var group = new Genre() { Genre_name = name }; await genreService.AddAndSave(group); }