public void Delete_EntityExists_EntityIsRemoved() { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { var person = CreatePerson(1); // Arrange steps.BeginConversation(); steps.SavePerson(person); // Act steps.DeletePerson(person); // Assert steps.VerifyPersonDoesntExist(person); } } }
public void Get_EntityExists_ReturnsCorrespondingEntity() { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { var person = CreatePerson(1); // Arrange steps.BeginConversation(); steps.SavePerson(person); // Act steps.IssueGetPerson(person.Id); // Assert steps.VerifyRetrievedPerson(person); } } }
public void Save_EntityExists_ThrowInvalidOperationException() { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { var person = CreatePerson(1); // Arrange steps.BeginConversation(); steps.AddPeopleToStore(new Person[] { person }); // Act Assert.Throws<InvalidOperationException>(() => steps.SavePerson(person)); } } }
public void Save_EntityDoesntExists_EntityIsAddedAndIdIsAssigned() { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { var person = CreatePerson(1); // Arrange steps.BeginConversation(); // Act steps.SavePerson(person); // Assert steps.VerifyIdIsAssigned(person); steps.VerifyPersonExists(person); } } }