public void AddAndGetCalculatedDataItem_NullAndEmptyStringLocale_NullAndEmptyStringLocalesAreTreatedSame()
        {
            CalculatedDataItemCollection calculatedDataItemCollection = new CalculatedDataItemCollection();

            const string strData = "Testing";

            calculatedDataItemCollection.AddCalculatedDataItem(new CalculatedDataItemCacheKey(CalculatedDataItemType.GridCellTaxa, null), strData);
            CalculatedDataItem <string> calculatedDataItem = calculatedDataItemCollection.GetCalculatedDataItem <string>(new CalculatedDataItemCacheKey(CalculatedDataItemType.GridCellTaxa, ""));

            Assert.AreEqual("Testing", calculatedDataItem.Data);
        }
        public void AddAndGetCalculatedDataItem_GenericLocale_DataIsReturned()
        {
            CalculatedDataItemCollection calculatedDataItemCollection = new CalculatedDataItemCollection();

            const string strData = "Testing";

            calculatedDataItemCollection.AddCalculatedDataItem(new CalculatedDataItemCacheKey(CalculatedDataItemType.GridCellTaxa, null), strData);
            CalculatedDataItem <string> calculatedDataItem = calculatedDataItemCollection.GetCalculatedDataItem <string>(new CalculatedDataItemCacheKey(CalculatedDataItemType.GridCellTaxa, null));

            Assert.AreEqual("Testing", calculatedDataItem.Data);
        }
        public void AddAndGetCalculatedDataItem_AddWithSwedishLocaleGetWithEnglishLocale_DataIsEmpty()
        {
            const string strData    = "Testing";
            const string addIsoCode = "sv";
            const string getIsoCode = "en";
            CalculatedDataItemCollection calculatedDataItemCollection = new CalculatedDataItemCollection();

            calculatedDataItemCollection.AddCalculatedDataItem(CalculatedDataItemType.GridCellTaxa, addIsoCode, strData);
            CalculatedDataItem <string> calculatedDataItem = calculatedDataItemCollection.GetCalculatedDataItem <string>(CalculatedDataItemType.GridCellTaxa, getIsoCode);

            Assert.IsNull(calculatedDataItem.Data);
        }
        public void AddAndGetCalculatedDataItem_AddWithSwedishLocaleGetWithSwedishLocale_DataIsReturned()
        {
            const string strData    = "Testing";
            const string addIsoCode = "sv";
            const string getIsoCode = "sv";
            CalculatedDataItemCollection calculatedDataItemCollection = new CalculatedDataItemCollection();

            calculatedDataItemCollection.AddCalculatedDataItem(CalculatedDataItemType.GridCellTaxa, addIsoCode, strData);
            CalculatedDataItem <string> calculatedDataItem = calculatedDataItemCollection.GetCalculatedDataItem <string>(CalculatedDataItemType.GridCellTaxa, getIsoCode);

            Assert.AreEqual("Testing", calculatedDataItem.Data);
        }
Example #5
0
        void Session_Start(object sender, EventArgs e)
        {
            string requestCookies = Request.Headers["Cookie"];

            if ((requestCookies != null) && (requestCookies.IndexOf("ASP.NET_SessionId") >= 0))
            {
                //cookie existed, so this new one is due to timeout.
                //Redirect the user
                //System.Diagnostics.Debug.WriteLine("Session expired!");
                //Response.RedirectToRoute(new { controller = "Home", Action = "Index" });
            }

            // You can't use SessionHandler.Language in Global.asax since we don't have any request yet
            Session["language"] = Thread.CurrentThread.CurrentUICulture.Name;
            //SessionHandler.Language = Thread.CurrentThread.CurrentUICulture.Name;
            Session["results"]    = new CalculatedDataItemCollection();
            Session["mySettings"] = new MySettings();

#if !DEBUG
            NewsScrapeHelper.UpdateNews(Request.PhysicalApplicationPath);
#endif
        }