public void Delete_EntityDoesntExists_NoChange() { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { var person = CreatePerson(1); // Arrange steps.BeginConversation(); // Act steps.DeletePerson(person); } } }
public void Get_EntityDoesntExist_ReturnsNull() { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { // Arrange steps.BeginConversation(); // Act steps.IssueGetPerson(Guid.NewGuid()); // Assert steps.VerifyRetrievedPersonIsNull(); } } }
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 Update_EntityExists_EntityIsUpdated() { 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 steps.UpdatePerson(person); // Assert steps.VerifyPersonExists(person); } } }
public void Update_EntityDoesntExists_ThrowInvalidOperationException() { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { var person = CreatePerson(1); // Arrange steps.BeginConversation(); // Act Assert.Throws<InvalidOperationException>(() => steps.UpdatePerson(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); } } }
public void Linq_ReturnsQueryableSetOfEntities(int count) { using(var store = new Store(BuildConfiguration())) { OnStoreCreate(store); using(var steps = new Steps(store)) { var people = Enumerable.Range(1, count).Select<int, Person>(CreatePerson).ToList(); // Given steps.BeginConversation(); steps.AddPeopleToStore(people); // When steps.IssuePersonQuery(); // Then steps.VerifyPersonQuery(people); } } }