Example #1
0
        public void When_rollback_called_submit_changes_not_store_changes()
        {
            using (var session = new RavenDbSession(_documentStore))
            {
                session.Save(new Employee {
                    Name = "John Smith"
                });
                session.Save(new Employee {
                    Name = "John Smith Clone1"
                });
                session.Save(new Employee {
                    Name = "John Smith Clone2"
                });

                session.CancelChanges();
                try
                {
                    session.SubmitChanges();
                }
                catch (InvalidOperationException)
                {
                }
            }

            using (var session = new RavenDbSession(_documentStore))
            {
                session.Query <Employee>().Should().HaveCount(0);
            }
        }
Example #2
0
        public void When_Submit_changes_is_not_called_no_changes_is_stored()
        {
            using (var session = new RavenDbSession(_documentStore))
            {
                session.Save(new Employee {
                    Name = "John Smith"
                });
                session.Save(new Employee {
                    Name = "John Smith Clone1"
                });
                session.Save(new Employee {
                    Name = "John Smith Clone2"
                });
            }

            using (var session = new RavenDbSession(_documentStore))
            {
                session.Query <Employee>().Should().HaveCount(0);
            }
        }