public void SaveWithoutIdTest() { ICRUDTestDBContextProvider cRUDTestDBContextProvider = new CRUDTestDBContextProvider(Guid.NewGuid().ToString()); GenreBE genreBE = new GenreBE(cRUDTestDBContextProvider); genreBE.New(); genreBE.Name = "TestGenreName"; genreBE.Save(); Assert.IsTrue(genreBE.Id != default); }
public void SaveValidIdTest() { ICRUDTestDBContextProvider cRUDTestDBContextProvider = new CRUDTestDBContextProvider(Guid.NewGuid().ToString()); var context = cRUDTestDBContextProvider.GetContext(); var genre = new Genre { GenreId = 1 }; context.Add(genre); context.SaveChanges(); GenreBE genreBE = new GenreBE(cRUDTestDBContextProvider); genreBE.Load(1); genreBE.Name = "TestGenreName"; genreBE.Save(); GenreBE genreBE2 = new GenreBE(cRUDTestDBContextProvider); genreBE2.Load(1); Assert.IsTrue(genreBE2.Id == 1); Assert.IsTrue(genreBE2.Name == "TestGenreName"); }