Example #1
0
        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);
                }
            }
        }
Example #2
0
        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);
                }
            }
        }
Example #3
0
        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));
                }
            }
        }
Example #4
0
        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);
                }
            }
        }