private static void CommonSetup(EnumsGeneratorItem item)
        {
            var isCommon = item.EnumName == "DockerComposeCommon";

            item.FilenameMaker = new TemplateFilenameMaker("{0}\\_shell\\{1}\\_dockerCompose\\{2}");
            if (isCommon)
            {
                item.WithInterface <ICommandsPartsProvider>();
            }
            else
            {
                item.WithInterface <IDockerComposeOption>();
                var name = item.Tags["name"];
                item.AddCustomCreator(c =>
                {
                    var p = c.AddProperty("Name", "string")
                            .WithIsPropertyReadOnly()
                            .WithNoEmitField()
                            .WithOwnGetter(name.CsEncode());
                    p.OwnGetterIsExpression = true;
                });
            }

            item.AddCustomCreator(c =>
            {
                c.AddMethod("GetItems", c.GetTypeName(typeof(IEnumerable <string>)))
                .WithBody("return GetCodeItems();");
            });
        }
Example #2
0
        public void T02b_Should_compute_namespace_and_name()
        {
            var tmp = new EnumsGeneratorItem
            {
                Names          = "Other.Bla",
                Options        = OptionsCollection.Parse(sampleOptions, ParserKind.Default),
                TargetAssembly = typeof(EnumsGeneratorTests).Assembly
            };

            Assert.Equal("iSukces.SimpleLinux.Tests.Other", tmp.Namespace);
            Assert.Empty(tmp.OwnerClasses);
            Assert.Equal("Bla", tmp.EnumName);
        }
Example #3
0
 private static void CommonSetup(EnumsGeneratorItem item)
 {
     item.FilenameMaker = new TemplateFilenameMaker("{0}\\_shell\\{1}\\{2}");
 }