public void SaveWithoutIdTest() { ICRUDTestDBContextProvider cRUDTestDBContextProvider = new CRUDTestDBContextProvider(Guid.NewGuid().ToString()); ArtistBE artistBE = new ArtistBE(cRUDTestDBContextProvider); artistBE.New(); artistBE.Name = "TestArtistName"; artistBE.Save(); Assert.IsTrue(artistBE.Id != default); }
public void SaveValidIdTest() { ICRUDTestDBContextProvider cRUDTestDBContextProvider = new CRUDTestDBContextProvider(Guid.NewGuid().ToString()); var context = cRUDTestDBContextProvider.GetContext(); var artist = new Artist { ArtistId = 1 }; context.Add(artist); context.SaveChanges(); ArtistBE artistBE = new ArtistBE(cRUDTestDBContextProvider); artistBE.Load(1); artistBE.Name = "TestArtistName"; artistBE.Save(); ArtistBE artistBE2 = new ArtistBE(cRUDTestDBContextProvider); artistBE2.Load(1); Assert.IsTrue(artistBE2.Id == 1); Assert.IsTrue(artistBE2.Name == "TestArtistName"); }