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

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