Ejemplo n.º 1
0
        public async Task Binding_Can_Create_More_Object_Than_Max_Stack()
        {
            var dataContext = new BigCollectionVM <Simple>(_ => new Simple());
            var test        = new TestInContext()
            {
                Bind = (win) => HtmlBinding.Bind(win, dataContext, JavascriptBindingMode.TwoWay),
                Test = (mb) =>
                {
                    var js = mb.JsRootObject;

                    var res = GetCollectionAttribute(js, "Values");
                    res.GetArrayLength().Should().Be(BigCollectionVM <Simple> .Limit);

                    var lastElement = res.GetValue(BigCollectionVM <Simple> .Limit - 1);
                    var id          = GetIntAttribute(lastElement, "Id");
                    id.Should().Be(23);
                }
            };

            await RunAsync(test);
        }
Ejemplo n.º 2
0
        public async Task Binding_Can_Create_Collection_With_Count_Greater_Than_Max_Stack()
        {
            var value       = 3;
            var dataContext = new BigCollectionVM <int>(value);
            var test        = new TestInContext()
            {
                Bind = (win) => HtmlBinding.Bind(win, dataContext, JavascriptBindingMode.TwoWay),
                Test = (mb) =>
                {
                    var js = mb.JsRootObject;

                    var res = GetCollectionAttribute(js, "Values");
                    res.GetArrayLength().Should().Be(BigCollectionVM <int> .Limit);

                    var lastElement = res.GetValue(BigCollectionVM <int> .Limit - 1);
                    lastElement.GetIntValue().Should().Be(value);
                }
            };

            await RunAsync(test);
        }