Esempio n. 1
0
        public void can_replace_base_ctor_argument_with_variable()
        {
            var type = new GeneratedType("SomeClass");

            type.InheritsFrom <ClassWithCtorArgs>();

            type.AllInjectedFields.Count.ShouldBe(3);
            type.BaseConstructorArguments.Length.ShouldBe(3);

            type.UseConstantForBaseCtor(Constant.ForEnum(Color.blue));

            type.AllInjectedFields.Count.ShouldBe(2);
            type.AllInjectedFields.Any(x => x.ArgType == typeof(Color))
            .ShouldBeFalse();

            type.BaseConstructorArguments[2].ShouldBeOfType <Variable>()
            .Usage.ShouldBe("LamarCompiler.Testing.Codegen.Color.blue");
        }