예제 #1
0
        public async Task GivenEventStore_WhenPublishingToStream_ThenWeGetEventPublished()
        {
            var configuration = new EventStoreConfiguration(
                new ConfigurationBuilder().Build()
                );

            var factory = new EventStoreClientFactory(configuration);

            using var client = factory.Create();

            var data = new List <EventData>
            {
                new TestEvent {
                    Name = "🦄",
                }.ToEventData(),
                new TestEvent {
                    Name = "bob",
                }.ToEventData(),
            };

            var results = await client.AppendToStreamAsync(
                new TestStream(),
                StreamState.Any,
                data);

            if (results == null)
            {
                Assert.Inconclusive("the current event store is empty, but we could connect");
                return;
            }

            results.NextExpectedStreamRevision.ToUInt64().Should().NotBe(ulong.MinValue);
        }
예제 #2
0
        public async Task GivenEventStore_WhenReadingStream_ThenWeGetEvents()
        {
            var configuration = new EventStoreConfiguration(
                new ConfigurationBuilder().Build()
                );

            var factory = new EventStoreClientFactory(configuration);

            using var client = factory.Create();

            var results = client.ReadStreamAsync(
                new TestStream(),
                Direction.Forwards,
                0);

            if (results == null)
            {
                Assert.Inconclusive("the current event store is empty, but we could connect");
                return;
            }

            await foreach (var e in results)
            {
                e.Should().NotBe(null);
            }
        }
예제 #3
0
        public void GivenAFactory_WhenCreatingACLient_thenAClientIsInstantiated()
        {
            var configuration = new EventStoreConfiguration(
                new ConfigurationBuilder().Build()
                );

            var factory = new EventStoreClientFactory(configuration);

            var client = factory.Create();

            client.Should().NotBeNull();
        }
예제 #4
0
        public void GivenAFactory_WhenCreatingAClusterModeClient_thenAClientIsInstantiated()
        {
            var values = new Dictionary <string, string> {
                { "feats:eventstore:hostname", "host" },
                { "feats:eventstore:protocol", "https" },
                { "feats:eventstore:username", "user" },
                { "feats:eventstore:password", "pwd" },
                { "feats:eventstore:iscluster", "true" },
            };

            var configuration = new EventStoreConfiguration(
                new ConfigurationBuilder()
                .AddInMemoryCollection(values)
                .Build()
                );

            var factory = new EventStoreClientFactory(configuration);

            var client = factory.Create();

            client.Should().NotBeNull();
        }