public void CachedObjectsOfDifferentType()
        {
            HttpSessionStateBase session = mocks.HtmlHelper.ViewContext.HttpContext.Session;
            GeneralExpense       item1   = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderBy(c => c.Id).First();
            GeneralExpense       item2   = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderByDescending(c => c.Id).First();

            session.AddObjectToSession(Surface, "key1", item1);
            session.AddObjectToSession(Surface, "key2", item2);
            Assert.IsNull(session.GetObjectFromSession <Claim>(Surface, "key1"));
            Assert.IsNull(session.GetObjectFromSession <Claim>(Surface, "key1"));
        }
        public void CachedObjectsOfBaseType()
        {
            HttpSessionStateBase session = mocks.HtmlHelper.ViewContext.HttpContext.Session;
            GeneralExpense       item1   = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderBy(c => c.Id).First();
            GeneralExpense       item2   = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderByDescending(c => c.Id).First();

            session.AddObjectToSession(NakedObjectsFramework, "key1", item1);
            session.AddObjectToSession(NakedObjectsFramework, "key2", item2);
            Assert.AreEqual(item1, session.GetObjectFromSession <GeneralExpense>(NakedObjectsFramework, "key1"));
            Assert.AreEqual(item2, session.GetObjectFromSession <AbstractExpenseItem>(NakedObjectsFramework, "key2"));
        }
        public void CachedObjectsOfDifferentType()
        {
            GeneralExpense item1 = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderBy(c => c.Id).First();
            GeneralExpense item2 = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderByDescending(c => c.Id).First();

            mocks.HtmlHelper.ViewContext.HttpContext.Session.AddToCache(NakedObjectsFramework, item1);
            mocks.HtmlHelper.ViewContext.HttpContext.Session.AddToCache(NakedObjectsFramework, item2);

            IObjectSpec spec = (IObjectSpec)NakedObjectsFramework.MetamodelManager.GetSpecification(typeof(Claim));

            Assert.IsFalse(mocks.HtmlHelper.ViewContext.HttpContext.Session.CachedObjectsOfType(NakedObjectsFramework, spec).Contains(item1));
            Assert.IsFalse(mocks.HtmlHelper.ViewContext.HttpContext.Session.CachedObjectsOfType(NakedObjectsFramework, spec).Contains(item2));
            Assert.IsTrue(!mocks.HtmlHelper.ViewContext.HttpContext.Session.CachedObjectsOfType(NakedObjectsFramework, spec).Any());
        }
Пример #4
0
        public void CachedObjectsOfDifferentType()
        {
            GeneralExpense item1 = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderBy(c => c.Id).First();
            GeneralExpense item2 = NakedObjectsFramework.Persistor.Instances <GeneralExpense>().OrderByDescending(c => c.Id).First();

            mocks.HtmlHelper.ViewContext.HttpContext.Session.AddToCache(Surface, item1);
            mocks.HtmlHelper.ViewContext.HttpContext.Session.AddToCache(Surface, item2);

            var spec = Surface.GetDomainType(typeof(Claim).FullName);

            Assert.IsFalse(mocks.HtmlHelper.ViewContext.HttpContext.Session.CachedObjectsOfType(Surface, spec).Contains(item1));
            Assert.IsFalse(mocks.HtmlHelper.ViewContext.HttpContext.Session.CachedObjectsOfType(Surface, spec).Contains(item2));
            Assert.IsTrue(!mocks.HtmlHelper.ViewContext.HttpContext.Session.CachedObjectsOfType(Surface, spec).Any());
        }
        public void Install()
        {
            SVEN = EmployeeFixture.SVEN;
            DICK = EmployeeFixture.DICK;

            SVEN_CLAIM_3 = CreateNewClaim(SVEN, DICK, "23rd Feb - Sales trip, London", ProjectCodeFixture.CODE1, new DateTime(2007, 4, 3));
            var feb23rd = new DateTime(2007, 2, 23);

            AddTaxi(SVEN_CLAIM_3, feb23rd, null, 18M, "Euston", "City", false);
            AddTaxi(SVEN_CLAIM_3, feb23rd, null, 10M, "City", "West End", false);
            GeneralExpense meal = AddMeal(SVEN_CLAIM_3, feb23rd, "Lunch with client", 50M);

            SVEN_CLAIM_3.Submit(DICK, false);
            meal.Reject("Too expensive");
            SVEN_CLAIM_3.ApproveItems(true);
            SVEN_CLAIM_3.ReturnToClaimant("Please discuss Meal item with me", false);
        }