public void which_already_exists_should_fail() { const string stream = "which_already_exists_should_fail"; using (var connection = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var initialCreate = connection.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(initialCreate.Wait); var secondCreate = connection.CreateStreamAsync(stream, new byte[0]); Assert.Inconclusive(); //Assert.That(() => secondCreate.Wait(), Throws.Exception.TypeOf<AggregateException>().With.InnerException.TypeOf<WrongExpectedVersionException>()); } }
public void which_was_deleted_should_fail() { const string stream = "which_was_deleted_should_fail"; using (var connection = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = connection.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); var delete = connection.DeleteStreamAsync(stream, ExpectedVersion.EmptyStream); Assert.DoesNotThrow(delete.Wait); var secondCreate = connection.CreateStreamAsync(stream, new byte[0]); Assert.That(() => secondCreate.Wait(), Throws.Exception.TypeOf <AggregateException>().With.InnerException.TypeOf <StreamDeletedException>()); } }
public void which_supposed_to_be_system_should_succees__but_on_your_own_risk() { const string stream = "$which_supposed_to_be_system_should_succees__but_on_your_own_risk"; using (var connection = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = connection.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); } }
public void which_does_not_exist_should_be_successfull() { const string stream = "which_does_not_exist_should_be_successfull"; using (var connection = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = connection.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); } }
public void should_fail_appending_with_wrong_exp_ver_to_existing_stream() { const string stream = "should_fail_appending_with_wrong_exp_ver_to_existing_stream"; using (var store = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = store.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); var append = store.AppendToStreamAsync(stream, 1, new[] { new TestEvent() }); Assert.That(() => append.Wait(), Throws.Exception.TypeOf <AggregateException>().With.InnerException.TypeOf <WrongExpectedVersionException>()); } }
public void should_append_with_any_exp_ver_to_existing_stream() { const string stream = "should_append_with_any_exp_ver_to_existing_stream"; using (var store = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = store.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); var append = store.AppendToStreamAsync(stream, ExpectedVersion.Any, new[] { new TestEvent() }); Assert.DoesNotThrow(append.Wait); } }
public void with_invalid_expected_version_should_fail() { const string stream = "with_invalid_expected_version_should_fail"; using (var connection = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = connection.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); var delete = connection.DeleteStreamAsync(stream, 1); Assert.That(() => delete.Wait(), Throws.Exception.TypeOf <AggregateException>().With.InnerException.TypeOf <WrongExpectedVersionException>()); } }
public void which_already_exists_should_success_when_passed_any_for_expected_version() { const string stream = "which_already_exists_should_success_when_passed_any_for_expected_version"; using (var connection = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = connection.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); var delete = connection.DeleteStreamAsync(stream, ExpectedVersion.Any); Assert.DoesNotThrow(delete.Wait); } }
public void can_append_multiple_events_at_once() { const string stream = "can_append_multiple_events_at_once"; using (var store = new EventStoreConnection(MiniNode.Instance.TcpEndPoint)) { var create = store.CreateStreamAsync(stream, new byte[0]); Assert.DoesNotThrow(create.Wait); var events = Enumerable.Range(0, 100).Select(i => new TestEvent(i.ToString(), i.ToString())); var append = store.AppendToStreamAsync(stream, ExpectedVersion.EmptyStream, events); Assert.DoesNotThrow(append.Wait); } }