public void Should_return_instance_with_set_property()
            {
                var sut = new DescriptorContainer <string>();

                var @return = sut.SetType("test");

                Assert.Equal("test", @return.Type);
            }
Beispiel #2
0
        public void RunCSharp()
        {
            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var descriptorContainer    = new DescriptorContainer(new WellKnownDescriptorContainer());

            descriptorContainer.Add(new CSharpDescriptor());
            var customActivityParser = new CustomActivityParser(descriptorContainer, wellKnownTypeContainer);
            var definition           = LoadDefinition("csharp");
            var activity             = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler             = new ActivityCompiler(wellKnownTypeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var executor = new ActivityExecutor(null);

            executor.Run(activity);
        }
Beispiel #3
0
        public void RunMirrorUpdate()
        {
            var code         = @"
    using System;
namespace MyModels
{
    public class student
    {
        public string id {get;set;}
        public student_data data { get; set; }
    }

    public class student_data
    {
        public string name {get;set;}
        public int age {get;set;}
    }
}
";
            var assemblyName = "t_123_v_1.1";

            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var typeContainer          = new TypeContainer(wellKnownTypeContainer);
            var assembly = DynamicModelLoader.Load(assemblyName, code);

            foreach (var type in assembly.GetTypes())
            {
                typeContainer.Add(type);
            }
            var descriptorContainer = new DescriptorContainer(new WellKnownDescriptorContainer());

            descriptorContainer.Add(new MirrorUpdateDescriptor());
            var customActivityParser = new CustomActivityParser(descriptorContainer, typeContainer);
            var definition           = LoadDefinition("mirrorUpdate");
            var activity             = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler             = new ActivityCompiler(typeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var executor = new ActivityExecutor(null);

            executor.Run(activity);
        }