예제 #1
0
 internal KeyValueEnumerator(DataModelList list)
 {
     _count = list._count;
     list.CreateArgs(out _args);
     _args.Index = -1;
     Current     = default;
 }
예제 #2
0
        public void ArrayTest()
        {
            // arrange
            var list = new DataModelList {
                new DataModelList {
                    ["key1"] = "val1"
                }, new DataModelList {
                    ["key2"] = "val2"
                }
            };
            var root = new DataModelList {
                ["root"] = list
            };

            /*			list.Add("", "empty");
             *                      list.Add(":#$%", "symbol");
             *                      list.Add("b", true);
             *                      list.Add("n", 1.5);
             *                      list.Add("dttm", DateTime.UtcNow);
             *                      list.Add("nl", DataModelValue.Null);
             *                      list.Add("undef", default);
             *                      list.Add(null, default, default);*/
            var nav = new DataModelXPathNavigator(root);

            // act
            var _ = (XPathNodeIterator?)nav.Evaluate("/root/node()");

            // assert
            //Assert.AreEqual(expected: "e", xml);
        }
예제 #3
0
 public override HttpContent?TryCreateHttpContent(WebRequest webRequest,
                                                  string?contentType,
                                                  DataModelList parameters,
                                                  DataModelValue value)
 {
     if (!ContentTypeEquals(contentType, MediaTypeApplicationFormUrlEncoded))
     {
         return(default);
        public DataModelArrayWrapper(Engine engine, DataModelList list) : base(engine)
        {
            _list = list;

            var writable = list.Access == DataModelAccess.Writable;

            Extensible = writable;

            base.SetOwnProperty(propertyName: @"length", new PropertyDescriptor((uint)_list.Count, writable, enumerable: false, configurable: false));
        }
예제 #5
0
        private static XPathNodeIterator CreateIterator(DataModelList list, string key)
        {
            var navigator = new DataModelXPathNavigator(list);

            navigator.MoveToFirstChild();
            while (navigator.Name != key)
            {
                var moved = navigator.MoveToNext();

                Infra.Assert(moved);
            }

            return(new XPathSingleElementIterator(navigator));
        }
예제 #6
0
            public DataModelList GetProperties()
            {
                var properties = new DataModelList
                {
                    { @"SessionId", SessionId },
                    { @"InvokeType", Type.ToString() }
                };

                if (Source is { } source)
                {
                    properties.Add(key: @"Source", source.ToString());
                }

                properties.MakeDeepConstant();

                return(properties);
            }
예제 #7
0
            public DataModelList GetProperties()
            {
                var properties = new DataModelList();

                if (Uri is { } uri)
                {
                    properties.Add(key: @"Uri", uri.ToString());
                }

                if (Scxml is { } scxml)
                {
                    properties.Add(key: @"SCXML", scxml);
                }

                properties.MakeDeepConstant();

                return(properties);
            }
예제 #8
0
        public void RenderValidXml()
        {
            // arrange
            var root = new DataModelList
            {
                {
                    "root",
                    new DataModelList
                    {
                        { "item", "val1" },
                        { "item", "val2" }
                    },
                    new DataModelList
                    {
                        "prefix",
                        "namespace-uri",
                        "attr1", "aVal1", "", "",
                        "attr2", "aVal2", "pfx", "attr-ns",
                        "myNs", "myNamespace", "", "http://www.w3.org/2000/xmlns/"
                    }
                }
            };


            // act
            var navigator = new DataModelXPathNavigator(root);

            // assert
            var xml = navigator.InnerXml;

            var value = XmlConverter.FromXml(xml);

            var n2   = new DataModelXPathNavigator(value);
            var xml2 = n2.InnerXml;

            var dataModelValue2 = XmlConverter.FromXml(xml2);

            var n3 = new DataModelXPathNavigator(dataModelValue2);
            var _  = n3.InnerXml;
        }
예제 #9
0
 public virtual HttpContent?TryCreateHttpContent(WebRequest webRequest,
                                                 string?contentType,
                                                 DataModelList parameters,
                                                 DataModelValue value) =>
 default;
예제 #10
0
 public virtual ValueTask <DataModelValue?> TryParseResponseAsync(WebResponse webResponse, DataModelList parameters, CancellationToken token) => default;
예제 #11
0
 public override HttpContent?TryCreateHttpContent(WebRequest webRequest,
                                                  string?contentType,
                                                  DataModelList parameters,
                                                  DataModelValue value) =>
 ContentTypeEquals(contentType, MediaTypeApplicationJson) ? new HttpClientJsonHandlerHttpContent(value, MediaTypeApplicationJson) : default;
예제 #12
0
 public virtual void PrepareRequest(WebRequest webRequest,
                                    string?contentType,
                                    DataModelList parameters,
                                    DataModelValue value)
 {
 }
예제 #13
0
        public override async ValueTask <DataModelValue?> TryParseResponseAsync(WebResponse webResponse, DataModelList parameters, CancellationToken token)
        {
            if (webResponse is null)
            {
                throw new ArgumentNullException(nameof(webResponse));
            }

            if (!ContentTypeEquals(webResponse.ContentType, MediaTypeApplicationJson))
            {
                return(default);
예제 #14
0
 public ListInfo(DataModelList dataModelList) => _dataModelList = dataModelList;
예제 #15
0
 public DebugView(DataModelList dataModelList) => _dataModelList = dataModelList;
예제 #16
0
 public override void PrepareRequest(WebRequest webRequest,
                                     string?contentType,
                                     DataModelList parameters,
                                     DataModelValue value) =>
 AppendAcceptHeader(webRequest, MediaTypeApplicationJson);
예제 #17
0
        public DataModelObjectWrapper(Engine engine, DataModelList list) : base(engine)
        {
            _list = list;

            Extensible = list.Access == DataModelAccess.Writable;
        }
예제 #18
0
 internal KeyValuePairEnumerable(DataModelList list) => _list = list;
예제 #19
0
 public void DataModelListNullTest()
 {
     // arrange
     DataModelList nullVal = default !;