Beispiel #1
0
        public void write_to_and_delete()
        {
            var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113);

            using (var connection = new EventStoreConnection(endpoint))
            {
                var ev     = new TestEvent("Some data");
                var stream = string.Format("test-delete-{0}", Guid.NewGuid());

                var appendTask = connection.AppendToStreamAsync(stream, -2, new[] { ev });
                appendTask.Wait();
                Assert.IsTrue(appendTask.Result.IsSuccessful, "Failed to append data to stream.");

                var data = connection.ReadEventStream(stream, 0, int.MaxValue);

                var lastEventVersion = data.Events[data.Events.Length - 1].EventNumber;

                var deleteTask = connection.DeleteStreamAsync(stream, lastEventVersion);
                deleteTask.Wait();
                Assert.IsTrue(deleteTask.Result.IsSuccessful, "Failed to delete stream.");
            }
        }
Beispiel #2
0
 public static EventStream ReadEventStream(string stream, int start, int count)
 {
     return(_connection.ReadEventStream(stream, start, count));
 }
Beispiel #3
0
        //[Test]
        //public void write_sync_null_failure()
        //{
        //    var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113);
        //    using (var connection = new EventStoreConnection(endpoint))
        //    {
        //        var ev = new TestEvent("Some data");
        //        var task = connection.AppendToStreamAsync("test", -2, new[] { ev });
        //        task.Wait();

        //        var result = task.Result;
        //        Assert.IsTrue(result.IsSuccessful, "Written Successfully");
        //    }
        //}

        public void write_to_and_delete() {
            var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113);
            using (var connection = new EventStoreConnection(endpoint))
            {
                var ev = new TestEvent("Some data");
                var stream = string.Format("test-delete-{0}", Guid.NewGuid());

                var appendTask = connection.AppendToStreamAsync(stream, -2, new[] { ev });
                appendTask.Wait();
                Debug.Assert(appendTask.Result.IsSuccessful, "Failed to append data to stream.");

                var data = connection.ReadEventStream(stream, 0, int.MaxValue);

                var lastEventVersion = data.Events[data.Events.Length - 1].EventNumber;

                var deleteTask = connection.DeleteStreamAsync(stream, lastEventVersion);
                deleteTask.Wait();
                Debug.Assert(deleteTask.Result.IsSuccessful, "Failed to delete stream.");
            }
        }