Exemplo n.º 1
0
        public void CanGetViewResult()
        {
            lock (TestOrderingLock.Lock)
            {
                var se       = new MinimalTypeSystemHack();
                var osResult = new ViewActionResult();

                osResult.ViewData             = InitViewData();
                osResult.ViewData["MyData"]   = ValueFactory.Create("string data");
                osResult.ViewData["MyObject"] = new StructureImpl();

                osResult.ViewData.Model = new ArrayImpl();

                var realAction = osResult.CreateExecutableResult();
                Assert.IsType(typeof(string), realAction.ViewData["MyData"]);
                Assert.IsType(typeof(DynamicContextWrapper), realAction.ViewData["MyObject"]);
                Assert.IsType(typeof(DynamicContextWrapper), realAction.ViewData.Model);

                var structWrap = realAction.ViewData["MyObject"] as DynamicContextWrapper;
                var arrayWrap  = realAction.ViewData.Model as DynamicContextWrapper;

                Assert.Equal(osResult.ViewData["MyObject"], structWrap.UnderlyingObject);
                Assert.Equal(osResult.ViewData.Model, structWrap.UnderlyingObject);
            }
        }
        public void ViewResultDataAccessibleThroughScript()
        {
            var osResult = new ViewActionResult();

            osResult.ViewData           = InitViewData();
            osResult.ViewData["MyData"] = ValueFactory.Create("string data");

            Assert.Equal("string data", osResult.ViewData.GetIndexedValue(ValueFactory.Create("MyData")).AsString());
        }
Exemplo n.º 3
0
        public void ViewResultDataAccessibleThroughScript()
        {
            lock (TestOrderingLock.Lock)
            {
                var se       = new MinimalTypeSystemHack();
                var osResult = new ViewActionResult();
                osResult.ViewData           = InitViewData();
                osResult.ViewData["MyData"] = ValueFactory.Create("string data");

                Assert.Equal("string data", osResult.ViewData.GetIndexedValue(ValueFactory.Create("MyData")).AsString());
            }
        }
        public void CanGetViewResult()
        {
            var osResult = new ViewActionResult();

            osResult.ViewData             = InitViewData();
            osResult.ViewData["MyData"]   = ValueFactory.Create("string data");
            osResult.ViewData["MyObject"] = new StructureImpl();

            osResult.ViewData.Model = new ArrayImpl();

            var realAction = osResult.CreateExecutableResult();

            Assert.IsType <string>(realAction.ViewData["MyData"]);
            Assert.IsType <DynamicContextWrapper>(realAction.ViewData["MyObject"]);
            Assert.IsType <DynamicContextWrapper>(realAction.ViewData.Model);

            var structWrap = realAction.ViewData["MyObject"] as DynamicContextWrapper;
            var arrayWrap  = realAction.ViewData.Model as DynamicContextWrapper;

            Assert.Equal(osResult.ViewData["MyObject"], structWrap.UnderlyingObject);
            Assert.Equal(osResult.ViewData.Model, structWrap.UnderlyingObject);
        }