示例#1
0
        public async System.Threading.Tasks.Task ObjNodeTestAsync()
        {
            JSchemaGenerator generator = new JSchemaGenerator();
            JSchema          schema    = generator.Generate(typeof(Account));
            var node = new ObjectNode();

            node.InPorts   = new List <INode>();
            node.LogicPath = true;
            node.Schema    = schema.ToString();
            var account = new Account
            {
                Email     = "*****@*****.**",
                Name      = "Johe Doe",
                Age       = 20,
                DateBrith = new DateTimeOffset(1980, 1, 1, 12, 1, 2, new TimeSpan(-6, 0, 0)),
                Address   = new Address {
                    Line1 = "Mobile AL"
                },
                Duration  = new TimeSpan(12, 0, 1),
                LastLogin = DateTime.Now
            };

            node.JsonString = JsonConvert.SerializeObject(account);
            await node.Init(new PadExecutionContext()
            {
                Pad = new Pad(Engine.Enums.ExecutionMode.Normal)
                {
                    Nodes = new List <INode>()
                }
            });

            await node.Execute(node.Context);

            Assert.NotNull(node.ObjectValue);
        }