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); } }
public void When_rollback_called_and_submit_changes_is_not_called_no_one_exceptions_occured() { 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(); } }
public void When_rollback_called_IsRolledBack_flag_is_true() { 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(); session.IsCancelled.Should().BeTrue(); } }
public void When_rollback_called_invocation_of_submit_changes_should_failed() { 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(); Action action = () => session.SubmitChanges(); action.ShouldThrow <InvalidOperationException>(); } }