Ejemplo n.º 1
0
        public void GetRequestMetaTable()
        {
            MetaModel m     = Utils.CommonInitialize();
            var       route = RouteTable.Routes[0] as DynamicDataRoute;
            MetaTable t     = m.Tables[TestDataContext.TableFooDisplayName];

            Assert.IsNotNull(t, "#A1");

            // Surprise! A null check is present!
            AssertExtensions.Throws <ArgumentNullException> (() => {
                DynamicDataRouteHandler.GetRequestMetaTable(null);
            }, "#A2");

            MetaTable t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current);

            Assert.IsNull(t2, "#A3");

            DynamicDataRouteHandler.SetRequestMetaTable(HttpContext.Current, t);
            t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current);
            Assert.IsNotNull(t2, "#A4");
            Assert.AreEqual(t, t2, "#A4-1");
        }
Ejemplo n.º 2
0
        public void SetRequestMetaTable()
        {
            MetaModel m     = Utils.CommonInitialize();
            var       route = RouteTable.Routes[0] as DynamicDataRoute;
            MetaTable t     = m.Tables[TestDataContext.TableFooDisplayName];

            Assert.IsNotNull(t, "#A1");

            // And following the tradition... [drum roll] - NO NULL CHECK!
            AssertExtensions.Throws <NullReferenceException> (() => {
                DynamicDataRouteHandler.SetRequestMetaTable(null, t);
            }, "#A2");

            DynamicDataRouteHandler.SetRequestMetaTable(HttpContext.Current, t);
            MetaTable t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current);

            Assert.IsNotNull(t2, "#A3");
            Assert.AreEqual(t, t2, "#A3-1");

            DynamicDataRouteHandler.SetRequestMetaTable(HttpContext.Current, null);
            t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current);
            Assert.IsNull(t2, "#A4");
        }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DynamicDataRouteHandler.SetRequestMetaTable(Context, Global.DefaultModel.Tables.First());
 }