示例#1
0
 public override void Given()
 {
     base.Given();
     WiqlQueryBuilder = new WiqlQueryBuilder();
     QueryProvider    = new TeamFoundationServerWorkItemQueryProvider(new MockWorkItemStore(), WiqlQueryBuilder);
     Query            = new Query <IWorkItem>(QueryProvider, WiqlQueryBuilder);
 }
示例#2
0
        public override void Given()
        {
            base.Given();

            WorkItemStore = TimedAction(() => IntegrationSettings.CreateRestStore(), "REST", "WIS Create");

            ConfigureOptions();

            var pr         = new PropertyReflector();
            var pi         = new PropertyInspector(pr);
            var attMapper  = new AttributeMapperStrategy(pi);
            var mapper     = new WorkItemMapper(attMapper);
            var translator = new WiqlTranslator();
            var pe         = new PartialEvaluator();
            var qr         = new QueryRewriter();
            var wqb        = new WiqlQueryBuilder(translator, pe, qr);
            var qp         = new MapperTeamFoundationServerWorkItemQueryProvider(
                WorkItemStore,
                wqb,
                mapper);

            Query = new Query <Bug>(qp, wqb);

            _ids = new[]
            {
                8663955
            };
        }
示例#3
0
        /// <inheritdoc />
        public override void Given()
        {
            base.Given();

            var soapBuilder = new WiqlQueryBuilder();
            var soapQp      = new TeamFoundationServerWorkItemQueryProvider(Soap, soapBuilder);

            SoapQueryable = new Query <IWorkItem>(soapQp, soapBuilder);

            var restBuilder = new WiqlQueryBuilder();
            var restQp      = new TeamFoundationServerWorkItemQueryProvider(Rest, restBuilder);

            RestQueryable = new Query <IWorkItem>(restQp, restBuilder);
        }
示例#4
0
        /// <inheritdoc />
        public override void Given()
        {
            base.Given();

            var soapIms    = ((IInternalTeamProjectCollection)Soap.TeamProjectCollection).GetService <IIdentityManagementService2>().AsProxy();
            var translator = new WiqlTranslator();
            var idMapper   = new IdentityAliasValueConverter(soapIms, IntegrationSettings.TenantId, IntegrationSettings.Domains);
            var visitors   = new ExpressionVisitor[] { new PartialEvaluator(), new IdentityMappingVisitor(idMapper), new QueryRewriter() };

            var soapBuilder = new WiqlQueryBuilder(translator, visitors);
            var soapQp      = new TeamFoundationServerWorkItemQueryProvider(Soap, soapBuilder);

            SoapQueryable = new Query <IWorkItem>(soapQp, soapBuilder);

            var restBuilder = new WiqlQueryBuilder();
            var restQp      = new TeamFoundationServerWorkItemQueryProvider(Rest, restBuilder);

            RestQueryable = new Query <IWorkItem>(restQp, restBuilder);
        }
示例#5
0
        public override void Given()
        {
            var workItemStore     = new MockWorkItemStore(WorkItemStoreWorkItems, WorkItemStoreWorkItemLinks);
            var fieldMapper       = new CachingFieldMapper(new FieldMapper());
            var propertyReflector = new PropertyReflector();
            var propertyInspector = new PropertyInspector(propertyReflector);
            var builder           = new WiqlQueryBuilder(new RelativesAwareWiqlTranslator(fieldMapper), new PartialEvaluator(), new RelativesAwareQueryRewriter());
            var mapperStrategies  = new IWorkItemMapperStrategy[]
            {
                new AttributeMapperStrategy(propertyInspector,
                                            new TypeParser()),
                new WorkItemLinksMapperStrategy(propertyInspector, workItemStore),
                new ParentIdMapperStrategy(workItemStore)
            };
            var mapper        = new WorkItemMapper(mapperStrategies);
            var queryProvider = new RelativesAwareTeamFoundationServerWorkItemQueryProvider(workItemStore, builder, mapper, fieldMapper);

            Query = new Query <SimpleMockModel>(queryProvider, builder);
        }
示例#6
0
        public override void Given()
        {
            var workItemStore = CreateWorkItemStore();
            var fieldMapper   = CreateFieldMapper();

            var propertyInspector = CreatePropertyInspector();

            var mapperStrategies = new IWorkItemMapperStrategy[]
            {
                new AttributeMapperStrategy(propertyInspector),
                new WorkItemLinksMapperStrategy(propertyInspector, workItemStore)
            };

            var builder = new WiqlQueryBuilder(new WiqlTranslator(fieldMapper), new PartialEvaluator(), new QueryRewriter());
            var mapper  = new WorkItemMapper(mapperStrategies);

            var queryProvider = new MapperTeamFoundationServerWorkItemQueryProvider(workItemStore, builder, mapper);

            Query = new Query <T>(queryProvider, builder);
        }
        protected override object ExecuteImpl(Expression expression, Type itemType)
        {
            var query = (RelativesAwareTranslatedQuery)WiqlQueryBuilder.BuildQuery(expression);

            var results = query.WillEverHaveResults()
                ? ExecuteRawQuery(query.UnderlyingQueryType, query.ToQueryString())
                : Activator.CreateInstance(typeof(List <>).MakeGenericType(query.UnderlyingQueryType)) as IEnumerable;

            if (query.Relatives != null)
            {
                var asOf = query.AsOfDateTime ?? DateTime.Now;
                results = GetRelatives(results.Cast <IIdentifiable>(), query.Relatives, itemType, asOf);
            }
            else if (query.Projections.Count > 0)
            {
                return(Projector.Project(query.Projections, results.Cast <object>()));
            }

            return(results);
        }