public void Delete_ExistingEntity_DbEntryDeleted() { // arrange StubEntity newEntity = new StubEntity { Id = 1, Name = "test" }; _repository.Add(newEntity); _repository.Delete(newEntity); //assert Assert.Null(_testDbContext.Set <StubEntity>().Find(newEntity.Id)); }
public void Add_NeWEntity_DbEntryAdded() { // arrange StubEntity newEntity = new StubEntity { Id = 1, Name = "test" }; // act _repository.Add(newEntity); // assert Assert.Equal("test", _testDbContext.Set <StubEntity>().Find(newEntity.Id).Name); }
public void Update_ExistingEntity_DbEntryUpdated() { // arrange StubEntity newEntity = new StubEntity { Id = 1, Name = "test" }; _repository.Add(newEntity); _repository.Update(new StubEntity { Id = 1, Name = "edited" }); //assert Assert.Equal("edited", _testDbContext.Set <StubEntity>().Find(newEntity.Id).Name); }