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_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>(); } }
public void When_Submit_changes_is_called_all_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" }); session.SubmitChanges(); } using (var session = new RavenDbSession(_documentStore)) { session.Query <Employee>().Should().HaveCount(3); } }