public async Task EventStoreContext_CreatePersistentSubscriptionFromPosition_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.CreatePersistentSubscriptionFromPosition(streamName, groupName, EventStoreContextTestData.StartPosition); }, exceptionType);
        }
        public async Task EventStoreContext_CreatePersistentSubscriptionFromPosition_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.CreatePersistentSubscriptionFromPosition(EventStoreContextTestData.StreamName,
                                                                   EventStoreContextTestData.GroupName, EventStoreContextTestData.StartPosition);

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