public void CallingDelete_on_Repository_DeletesEntity_FromUnderlyingDbSet() { var context = new ShoutOutInMemoryDbContextFactory <ShoutOutContext>() .Create("shoutout"); var shoutOutRepository = new ShoutOutRepository <User>(context); shoutOutRepository.Add(_user); shoutOutRepository.Save(); shoutOutRepository.Delete(_user); shoutOutRepository.Save(); }
public void CallingAdd_On_Repository_AddsEntity_ToUnderlyingDbSet() { var context = new ShoutOutInMemoryDbContextFactory <ShoutOutContext>() .Create("shoutoutone"); var shoutOutRepository = new ShoutOutRepository <User>(context); shoutOutRepository.Add(_user); shoutOutRepository.Save(); context.Users.Count().ShouldBe(1); }
public void Creating_AnewEntity_AssignAnIdId() { var context = new ShoutOutInMemoryDbContextFactory <ShoutOutContext>() .Create("shoutout"); var shoutOutRepository = new ShoutOutRepository <User>(context); shoutOutRepository.Add(_user); shoutOutRepository.Save(); _user.Id.ShouldNotBeNull(); shoutOutRepository.GetEntityById(_user.Id).ShouldNotBeNull(); }