public void GetAll()
        {
            Expression <Func <Customer, bool> >   predicate = x => true;
            Expression <Func <Customer, string> > selector  = x => x.Name;
            var options = new QueryOptions <Customer>();

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.GetAll());
            mock.Setup(x => x.GetAll(It.IsAny <Expression <Func <Customer, bool> > >()));
            mock.Setup(x => x.GetAll(It.IsAny <Expression <Func <Customer, string> > >()));
            mock.Setup(x => x.GetAll(It.IsAny <Expression <Func <Customer, bool> > >(), It.IsAny <Expression <Func <Customer, string> > >()));
            mock.Setup(x => x.GetAll(It.IsAny <IQueryOptions <Customer> >()));
            mock.Setup(x => x.GetAll(It.IsAny <IQueryOptions <Customer> >(), It.IsAny <Expression <Func <Customer, string> > >()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            readOnlyService.GetAll();
            readOnlyService.GetAll(selector);
            readOnlyService.GetAll(predicate);
            readOnlyService.GetAll(predicate, selector);
            readOnlyService.GetAll(options);
            readOnlyService.GetAll(options, selector);

            mock.Verify(x => x.GetAll(), Times.Once);
            mock.Verify(x => x.GetAll(selector), Times.Once);
            mock.Verify(x => x.GetAll(predicate), Times.Once);
            mock.Verify(x => x.GetAll(predicate, selector), Times.Once);
            mock.Verify(x => x.GetAll(options), Times.Once);
            mock.Verify(x => x.GetAll(options, selector), Times.Once);
        }
        public void GetWithId()
        {
            int key = 1;
            Expression <Func <Customer, bool> > predicate = x => true;
            var fetchStrategy = new FetchQueryStrategy <Customer>();
            Expression <Func <Customer, string> > selector = x => x.Name;

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.Get(It.IsAny <int>()));
            mock.Setup(x => x.Get(It.IsAny <int>(), It.IsAny <IFetchQueryStrategy <Customer> >()));
            mock.Setup(x => x.Get(It.IsAny <int>(), It.IsAny <string[]>()));
            mock.Setup(x => x.Get(It.IsAny <int>(), It.IsAny <Expression <Func <Customer, object> >[]>()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            readOnlyService.Get(key);
            readOnlyService.Get(key, fetchStrategy);
            readOnlyService.Get(key, string.Empty);
            readOnlyService.Get(key, (Expression <Func <Customer, object> >[])null);

            mock.Verify(x => x.Get(key), Times.Once);
            mock.Verify(x => x.Get(key, fetchStrategy), Times.Once);
            mock.Verify(x => x.Get(key, string.Empty), Times.Once);
            mock.Verify(x => x.Get(key, (Expression <Func <Customer, object> >[])null), Times.Once);
        }
        public async Task GetDictionaryAsync()
        {
            Expression <Func <Customer, string> > selector = x => x.Name;
            var options = new QueryOptions <Customer>();

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.GetDictionaryAsync(It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetDictionaryAsync(It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetDictionaryAsync(It.IsAny <IQueryOptions <Customer> >(), It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetDictionaryAsync(It.IsAny <IQueryOptions <Customer> >(), It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <CancellationToken>()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            await readOnlyService.GetDictionaryAsync(selector);

            await readOnlyService.GetDictionaryAsync(selector, selector);

            await readOnlyService.GetDictionaryAsync(options, selector);

            await readOnlyService.GetDictionaryAsync(options, selector, selector);

            mock.Verify(x => x.GetDictionaryAsync(selector, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetDictionaryAsync(selector, selector, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetDictionaryAsync(options, selector, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetDictionaryAsync(options, selector, selector, default(CancellationToken)), Times.Once);
        }
        public void GroupBy()
        {
            Expression <Func <Customer, string> > selector = x => x.Name;
            Expression <Func <string, IEnumerable <Customer>, string> > grouping = (key, g) => key;
            var options = new QueryOptions <Customer>();

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.GetGroupBy(It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <Expression <Func <string, IEnumerable <Customer>, string> > >()));
            mock.Setup(x => x.GetGroupBy(It.IsAny <IQueryOptions <Customer> >(), It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <Expression <Func <string, IEnumerable <Customer>, string> > >()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            readOnlyService.GetGroupBy(selector, grouping);
            readOnlyService.GetGroupBy(options, selector, grouping);

            mock.Verify(x => x.GetGroupBy(selector, grouping), Times.Once);
            mock.Verify(x => x.GetGroupBy(options, selector, grouping), Times.Once);
        }
        public async Task GroupByAsync()
        {
            Expression <Func <Customer, string> > selector = x => x.Name;
            Expression <Func <string, IEnumerable <Customer>, string> > grouping = (key, g) => key;
            var options = new QueryOptions <Customer>();

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.GetGroupByAsync(It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <Expression <Func <string, IEnumerable <Customer>, string> > >(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetGroupByAsync(It.IsAny <IQueryOptions <Customer> >(), It.IsAny <Expression <Func <Customer, string> > >(), It.IsAny <Expression <Func <string, IEnumerable <Customer>, string> > >(), It.IsAny <CancellationToken>()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            await readOnlyService.GetGroupByAsync(selector, grouping);

            await readOnlyService.GetGroupByAsync(options, selector, grouping);

            mock.Verify(x => x.GetGroupByAsync(selector, grouping, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetGroupByAsync(options, selector, grouping, default(CancellationToken)), Times.Once);
        }
        public void GetCount()
        {
            Expression <Func <Customer, bool> > predicate = x => true;
            var options = new QueryOptions <Customer>();

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.GetCount());
            mock.Setup(x => x.GetCount(It.IsAny <Expression <Func <Customer, bool> > >()));
            mock.Setup(x => x.GetCount(It.IsAny <IQueryOptions <Customer> >()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            readOnlyService.GetCount();
            readOnlyService.GetCount(predicate);
            readOnlyService.GetCount(options);

            mock.Verify(x => x.GetCount(), Times.Once);
            mock.Verify(x => x.GetCount(predicate), Times.Once);
            mock.Verify(x => x.GetCount(options), Times.Once);
        }
        public async Task GetCountAsync()
        {
            Expression <Func <Customer, bool> > predicate = x => true;
            var options = new QueryOptions <Customer>();

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.GetCountAsync(default(CancellationToken)));
            mock.Setup(x => x.GetCountAsync(It.IsAny <Expression <Func <Customer, bool> > >(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetCountAsync(It.IsAny <IQueryOptions <Customer> >(), It.IsAny <CancellationToken>()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            await readOnlyService.GetCountAsync();

            await readOnlyService.GetCountAsync(predicate);

            await readOnlyService.GetCountAsync(options);

            mock.Verify(x => x.GetCountAsync(default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetCountAsync(predicate, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetCountAsync(options, default(CancellationToken)), Times.Once);
        }
        public async Task GetWithIdAsync()
        {
            int key = 1;
            Expression <Func <Customer, bool> > predicate = x => true;
            var fetchStrategy = new FetchQueryStrategy <Customer>();
            Expression <Func <Customer, string> > selector = x => x.Name;

            var mock = new Mock <IService <Customer> >();

            mock.Setup(x => x.GetAsync(It.IsAny <int>(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetAsync(It.IsAny <int>(), It.IsAny <IFetchQueryStrategy <Customer> >(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetAsync(It.IsAny <int>(), It.IsAny <string[]>(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetAsync(It.IsAny <int>(), It.IsAny <string[]>()));
            mock.Setup(x => x.GetAsync(It.IsAny <int>(), It.IsAny <Expression <Func <Customer, object> >[]>(), It.IsAny <CancellationToken>()));
            mock.Setup(x => x.GetAsync(It.IsAny <int>(), It.IsAny <Expression <Func <Customer, object> >[]>()));

            var readOnlyService = new ReadOnlyServiceWrapper <Customer, int>(mock.Object);

            await readOnlyService.GetAsync(key);

            await readOnlyService.GetAsync(key, fetchStrategy);

            await readOnlyService.GetAsync(key, new[] { string.Empty }, default(CancellationToken));

            await readOnlyService.GetAsync(key, string.Empty);

            await readOnlyService.GetAsync(key, (Expression <Func <Customer, object> >[]) null);

            await readOnlyService.GetAsync(key, (Expression <Func <Customer, object> >[]) null, default(CancellationToken));

            mock.Verify(x => x.GetAsync(key, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetAsync(key, fetchStrategy, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetAsync(key, new[] { string.Empty }, default(CancellationToken)), Times.Once);
            mock.Verify(x => x.GetAsync(key, string.Empty), Times.Once);
            mock.Verify(x => x.GetAsync(key, (Expression <Func <Customer, object> >[])null), Times.Once);
            mock.Verify(x => x.GetAsync(key, (Expression <Func <Customer, object> >[])null, default(CancellationToken)), Times.Once);
        }