public async Task EventStoreContext_CreatePersistentSubscriptionFromBeginning_InvalidData_ErrorThrown(String streamName, String groupName, Type exceptionType)
        {
            EventStoreConnectionSettings eventStoreConnectionSettings = EventStoreConnectionSettings.Create(EventStoreContextTestData.ConnectionString);
            Mock <IEventStoreConnection> connection = new Mock <IEventStoreConnection>();
            Mock <ISerialiser>           serialiser = new Mock <ISerialiser>();
            Func <EventStoreConnectionSettings, IEventStoreConnection> connectionResolver = settings =>
            {
                return(connection.Object);
            };

            PaymentCentric.Logging.Logger.Initialise(NullLogger.Instance);

            EventStoreContext context = new EventStoreContext(eventStoreConnectionSettings, connectionResolver, serialiser.Object);

            Should.Throw(async() => { await context.CreatePersistentSubscriptionFromBeginning(streamName, groupName); }, exceptionType);
        }
        public async Task EventStoreContext_CreatePersistentSubscriptionFromBeginning_SubscriptionCreated()
        {
            EventStoreConnectionSettings eventStoreConnectionSettings = EventStoreConnectionSettings.Create(EventStoreContextTestData.ConnectionString);
            Mock <IEventStoreConnection> connection = new Mock <IEventStoreConnection>();
            Mock <ISerialiser>           serialiser = new Mock <ISerialiser>();
            Func <EventStoreConnectionSettings, IEventStoreConnection> connectionResolver = settings =>
            {
                return(connection.Object);
            };

            PaymentCentric.Logging.Logger.Initialise(NullLogger.Instance);

            EventStoreContext context = new EventStoreContext(eventStoreConnectionSettings, connectionResolver, serialiser.Object);

            await context.CreatePersistentSubscriptionFromBeginning(EventStoreContextTestData.StreamName,
                                                                    EventStoreContextTestData.GroupName);

            connection.Verify(x => x.CreatePersistentSubscriptionAsync(EventStoreContextTestData.StreamName, EventStoreContextTestData.GroupName, It.IsAny <PersistentSubscriptionSettings>(), It.IsAny <UserCredentials>()));
        }