public void ClassSetUp()
        {
            _queryCommandService = new Mock <IQueryCommandService>();
            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _identityProvider    = new Mock <IServiceIdentityProvider>();

            var identityContext = new IdentityContext {
                IdentityId = Guid.NewGuid()
            };

            _identityProvider.Setup(x => x.GetPrincipalIdentifier()).Returns(identityContext.IdentityId);
            _identityProvider.Setup(x => x.GetIdentityContext()).Returns(identityContext);

            _factory           = new MockRepository(MockBehavior.Loose);
            _unitOfWorkAdmin   = _factory.Create <IAdministrationUnitOfWork>();
            _queryQueryService = new Administration.Services.Query.QueryQueryService(
                _queryCommandService.Object,
                _unitOfWorkAdmin.Object,
                Mock.Of <ILog>(),
                _authorizationPolicy.Object,
                _identityProvider.Object);

            _agency             = AdministrationUnitTestFixture.AgencyDetails;
            _queryConfiguration = _agency.CreateQueryConfiguration(1, "QueryName1", true);
            _queryConfiguration = _agency.CreateQueryConfiguration(2, "QueryName2", false);
            _unitOfWorkAdmin.Setup(item => item.Find <Agency>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_agency);

            _queryConfigurationList = new List <QueryConfiguration>();
            _queryConfigurationList.Add(_queryConfiguration);
            _unitOfWorkAdmin.Setup(item => item.Find <QueryConfiguration>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_queryConfiguration);

            _unitOfWorkAdmin.Setup(item => item.GetEntityQuery <QueryConfiguration>(It.IsAny <TrackingMode>()))
            .Returns(_queryConfigurationList.AsQueryable());
        }
        public void SetUp()
        {
            _unitOfWorkAdmin    = _factory.Create <IAdministrationUnitOfWork>();
            _agency             = AdministrationUnitTestFixture.AgencyDetails;
            _queryConfiguration = _agency.CreateQueryConfiguration(1, "QueryName2", false);
            _unitOfWorkAdmin.Setup(item => item.Find <Agency>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_agency);
            _unitOfWorkAdmin.Setup(item => item.Find <QueryConfiguration>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(_queryConfiguration);
            SetUpQueryConfiguration();
            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _identityProvider    = new Mock <IServiceIdentityProvider>();

            var identityContext = new IdentityContext {
                IdentityId = Guid.NewGuid()
            };

            _identityProvider.Setup(x => x.GetPrincipalIdentifier()).Returns(identityContext.IdentityId);
            _identityProvider.Setup(x => x.GetIdentityContext()).Returns(identityContext);

            _queryCommandService = new Administration.Services.Command.QueryCommandService(_unitOfWorkAdmin.Object, Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object);
        }