public void sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e6_wev() { const string stream = "appending_to_implicitly_created_stream_sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e6_wev"; using (var store = TestConnection.Create(_node.TcpEndPoint)) { store.ConnectAsync().Wait(); var events = Enumerable.Range(0, 6).Select(x => TestEvent.NewTestEvent(Guid.NewGuid())).ToArray(); var writer = new StreamWriter(store, stream, -1); var first6 = writer.Append(events); Assert.That(() => first6.Then(events.First(), 6), Throws.Exception.TypeOf <AggregateException>().With.InnerException.TypeOf <WrongExpectedVersionException>()); } }
public async Task sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e6_wev() { const string stream = "appending_to_implicitly_created_stream_sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e6_wev"; using (var store = BuildConnection(_node)) { await store.ConnectAsync(); var events = Enumerable.Range(0, 6).Select(x => TestEvent.NewTestEvent(Guid.NewGuid())).ToArray(); var writer = new StreamWriter(store, stream, -1); var first6 = await writer.Append(events); await AssertEx.ThrowsAsync <WrongExpectedVersionException>( () => first6.Then(events.First(), 6)); } }
public void sequence_0em1_0em1_idempotent() { const string stream = "appending_to_implicitly_created_stream_sequence_0em1_0em1_idempotent"; using (var store = BuildConnection(_node)) { store.ConnectAsync().Wait(); var events = Enumerable.Range(0, 1).Select(x => TestEvent.NewTestEvent(Guid.NewGuid())).ToArray(); var writer = new StreamWriter(store, stream, -1); Assert.DoesNotThrow(() => writer.Append(events).Then(events.First(), -1)); var total = EventsStream.Count(store, stream); Assert.That(total, Is.EqualTo(events.Length)); } }
public void sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e5_non_idempotent() { const string stream = "appending_to_implicitly_created_stream_sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e5_non_idempotent"; using (var store = TestConnection.Create(_node.TcpEndPoint)) { store.Connect(); var events = Enumerable.Range(0, 6).Select(x => TestEvent.NewTestEvent(Guid.NewGuid())).ToArray(); var writer = new StreamWriter(store, stream, -1); Assert.DoesNotThrow(() => writer.Append(events).Then(events.First(), 5)); var total = EventsStream.Count(store, stream); Assert.That(total, Is.EqualTo(events.Length + 1)); } }
public async Task sequence_0em1_0any_idempotent() { const string stream = "appending_to_implicitly_created_stream_sequence_0em1_0any_idempotent"; using (var store = BuildConnection(_node)) { await store.ConnectAsync(); var events = Enumerable.Range(0, 1).Select(x => TestEvent.NewTestEvent(Guid.NewGuid())).ToArray(); var writer = new StreamWriter(store, stream, -1); var tail = await writer.Append(events); await tail.Then(events.First(), ExpectedVersion.Any); var total = await EventsStream.Count(store, stream); Assert.That(total, Is.EqualTo(events.Length)); } }