public void Add_Should_AddCorrect() { var db = new TFContext(this.DatabaseSimulator()); var genreServices = new GenreServices(db); var genre = new Genre() { Name = genreNameToUse }; genreServices.Add(genre); Assert.AreEqual(1, db.Genres.Count()); }
public void Add_Should_ThrowWhenGenreAlreadyExists() { var db = new TFContext(this.DatabaseSimulator()); var genreServices = new GenreServices(db); var genre = new Genre() { Name = genreNameToUse }; db.Genres.Add(genre); db.SaveChanges(); Assert.ThrowsException <EntityAlreadyExistingException> (() => genreServices.Add(genre)); }