public void ShouldReturnTreeOfDelegateWithExternalComplexTypes()
        {
            var reader = DelegateReader.CreateWithDefaultAssemblyProvider();
            var tree   = reader.Read((MyDel3)(x =>
            {
                if (x.Value >= 0 && x.Value < 5)
                {
                    return(1);
                }
                else if (x.Value >= 5 && x.Value < 10)
                {
                    return(2);
                }
                return(3);
            }));

            tree.Should().NotBeNull();
            tree.FirstMethodOrDefault().Should().NotBeNull();
            tree.Warnings().Count.Should().Be(0);
        }
        public void ShouldReturnTreeOfSimpleDelegate()
        {
            var reader = DelegateReader.CreateWithDefaultAssemblyProvider();
            var tree   = reader.Read((MyDel1)(x =>
            {
                if (x >= 0 && x < 5)
                {
                    return(1);
                }
                else if (x >= 5 && x < 10)
                {
                    return(2);
                }
                return(3);
            }));

            tree.Should().NotBeNull();
            tree.FirstMethodOrDefault().Should().NotBeNull();
            tree.Warnings().Count.Should().Be(0);
        }
Esempio n. 3
0
 public static void ClassSetup(TestContext ctx)
 {
     _delegateReader = DelegateReader.CreateWithDefaultAssemblyProvider();
     _csharpCompiler = new CSharpCompiler();
 }
 public static void ClassSetup(TestContext ctx)
 {
     _delegateReader = DelegateReader.CreateWithDefaultAssemblyProvider();
     _csharpCompiler = new CSharpCompiler();
     _csharpCompiler.MainResolver.AddResolver(typeof(Foo <>), typeof(FooProxy <>));
 }