Exemplo n.º 1
0
        public void GetSpeciesObservationData_AddSpeciesObservationDataAndChangeMySettingsAfterwards_ResultCacheItemIsNotUpToDate()
        {
            SpeciesObservationsData speciesObservationsData;

            speciesObservationsData = CreateSpeciesObservationDataSample();

            CalculatedDataItemCacheManager.GetSpeciesObservationData(SessionHandler.MySettings, "").Data = speciesObservationsData;
            CalculatedDataItem <SpeciesObservationsData> calculatedDataItem = CalculatedDataItemCacheManager.GetSpeciesObservationData(SessionHandler.MySettings, "");

            SessionHandler.MySettings.ResultCacheNeedsRefresh = false;
            SessionHandler.MySettings.Filter.Taxa.AddTaxonId(1);

            Assert.IsFalse(calculatedDataItem.HasFreshData);
        }
Exemplo n.º 2
0
        public void GetSpeciesObservationData_AddSpeciesObservationDataBeforeGet_ResultCacheItemReturned()
        {
            SpeciesObservationsData speciesObservationsData;

            speciesObservationsData = CreateSpeciesObservationDataSample();

            CalculatedDataItemCacheManager.GetSpeciesObservationData(SessionHandler.MySettings, "sv").Data = speciesObservationsData;
            CalculatedDataItem <SpeciesObservationsData> calculatedDataItem = CalculatedDataItemCacheManager.GetSpeciesObservationData(SessionHandler.MySettings, "sv");

            SessionHandler.MySettings.ResultCacheNeedsRefresh = false;

            Assert.IsTrue(calculatedDataItem.HasData);
            Assert.IsTrue(calculatedDataItem.HasFreshData);
        }
        public void GetQueryComplexityEstimate_ObservationMapWithoutTaxaFilterButWithCachedResult_ReturnFastEstimate()
        {
            SpeciesObservationsData speciesObservationsData;

            //QueryComplexityEstimate result;
            LoginApplicationUser();

            speciesObservationsData = CreateSpeciesObservationData(SessionHandler.UserContext, SessionHandler.MySettings);
            CalculatedDataItemCacheManager.GetSpeciesObservationData(SessionHandler.MySettings, "").Data = speciesObservationsData;
            SpeciesObservationResultCalculator resultCalculator = new SpeciesObservationResultCalculator(SessionHandler.UserContext, SessionHandler.MySettings);
            QueryComplexityEstimate            result           = resultCalculator.GetQueryComplexityEstimate();

            //result = QueryComplexityManager.GetQueryComplexityEstimate(ResultType.SpeciesObservationMap, SessionHandler.UserContext, SessionHandler.MySettings);
            Assert.AreEqual(QueryComplexityExecutionTime.Fast, result.QueryComplexityExecutionTime);
        }
        public void GetResult_OneTaxaFilter_ResultCacheIsPopulated()
        {
            SpeciesObservationDiagramResultCalculator resultCalculator;
            List <KeyValuePair <string, string> >     result;
            CalculatedDataItem <List <KeyValuePair <string, string> > > calculatedDataItem;

            LoginApplicationUser();
            SessionHandler.MySettings.Filter.Taxa.AddTaxonId(1);
            resultCalculator = new SpeciesObservationDiagramResultCalculator(SessionHandler.UserContext, SessionHandler.MySettings);
            //Calculate result and check that it is cashed.
            result = resultCalculator.CalculateResult();

            calculatedDataItem = CalculatedDataItemCacheManager.GetCalculatedDataItem <List <KeyValuePair <string, string> > >(CalculatedDataItemType.SpeciesObservationDiagramData, SessionHandler.MySettings, null);
            Assert.IsTrue(calculatedDataItem.HasData);
        }
Exemplo n.º 5
0
 public CalculatedDataItem <T> GetCacheCalculatedDataItem <T>(CalculatedDataItemType calculatedDataItemType, string localeISOCode)
 {
     return(CalculatedDataItemCacheManager.GetCalculatedDataItemEx <T>(calculatedDataItemType, MySettings, localeISOCode));
 }
Exemplo n.º 6
0
 public CalculatedDataItem <T> GetCacheCalculatedDataItem <T>(CalculatedDataItemType calculatedDataItemType)
 {
     return(CalculatedDataItemCacheManager.GetCalculatedDataItemEx <T>(calculatedDataItemType, MySettings));
 }