Esempio n. 1
0
        public void Verify_Data_Returned()
        {
            ProductAnalyticsAPIClient data = new ProductAnalyticsAPIClient();
            long           germPlasmId     = 457931693752320;
            List <IFilter> postAPIFilters  = new List <IFilter>();
            UDRList        udrList         = GetSimpleUDRList();

            IFilter[] filters = new List <IFilter>()
            {
                FilterBase.GetFilterDefinition("testSetSeason=2015:04", postAPIFilters, udrList)
            }.ToArray();
            List <string> observations = new List <string>()
            {
                "MST",
                "YLD_BE",
                "SELIN",
                "TWT_BE"
            };
            HttpClient httpClient = new HttpClient();
            List <Dictionary <string, dynamic> > entryMeans;

            CancellationTokenSource cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(90));

            entryMeans = data.GetEntryMeansAsynch(contextMock.Object, httpClient, cancellationToken.Token, "USER_A", germPlasmId, filters, observations, "Apples", null).Result;

            Assert.NotEqual <int>(0, entryMeans.Count);
            httpClient.Dispose();
            httpClient = null;
        }
Esempio n. 2
0
        public FilterApplicator(List <string> filters, UDRList udrList)
        {
            FilterBase     filterBase;
            List <IFilter> postAPIFilters = new List <IFilter>();
            List <IFilter> preAPIFilters  = new List <IFilter>();

            foreach (string filterString in filters)
            {
                filterBase = FilterBase.GetFilterDefinition(filterString, postAPIFilters, udrList);
                if (filterBase is APIBodyFilter || filterBase is QueryStringFilter)
                {
                    preAPIFilters.Add(filterBase);
                }
                else
                {
                    postAPIFilters.Add(filterBase);
                }
            }
            this.apiFilters     = preAPIFilters.ToArray();
            this.postAPIFilters = postAPIFilters.ToArray();
        }