public void TestEnumWithFlagsGeneration()
        {
            // Arrange
            var definition = new CSharpEnumDefinition
            {
                Namespaces =
                {
                    "System"
                },
                Attributes =
                {
                    new MetadataAttribute("Flags")
                },
                AccessModifier = AccessModifier.Public,
                Name           = "CarOptions",
                Sets           =
                {
                    new NameValue("SunRoof",       "0x01"),
                    new NameValue("Spoiler",       "0x02"),
                    new NameValue("FogLights",     "0x04"),
                    new NameValue("TintedWindows", "0x08")
                }
            };

            // Act
            CSharpEnumBuilder.CreateFiles("C:\\Temp\\CatFactory.NetCore\\DesignPatterns", string.Empty, true, definition);
        }
Ejemplo n.º 2
0
        public void TestEnumWithFlagsGeneration()
        {
            // Arrange
            var definition = new CSharpEnumDefinition
            {
                Namespaces = new List <string>
                {
                    "System"
                },
                Attributes = new List <MetadataAttribute>
                {
                    new MetadataAttribute("Flags")
                },
                Name = "CarOptions",
                Sets = new List <INameValue>
                {
                    new NameValue {
                        Name = "SunRoof", Value = "0x01"
                    },
                    new NameValue {
                        Name = "Spoiler", Value = "0x02"
                    },
                    new NameValue {
                        Name = "FogLights", Value = "0x04"
                    },
                    new NameValue {
                        Name = "TintedWindows", Value = "0x08"
                    }
                }
            };

            // Act
            CSharpEnumBuilder.CreateFiles("C:\\Temp\\CatFactory.DotNetCore", string.Empty, true, definition);
        }
        public void TestSimpleEnumGeneration()
        {
            // Arrange
            var definition = new CSharpEnumDefinition
            {
                Namespace      = "DesignPatterns",
                AccessModifier = AccessModifier.Public,
                Name           = "OperationMode",
                Documentation  = new Documentation("Represents operation mode for persistance"),
                Sets           =
                {
                    new NameValue("First",  "0"),
                    new NameValue("Second", "1"),
                    new NameValue("Third",  "2")
                }
            };

            // Act
            CSharpEnumBuilder.CreateFiles("C:\\Temp\\CatFactory.NetCore\\DesignPatterns", string.Empty, true, definition);
        }
Ejemplo n.º 4
0
        public void TestSimpleEnumGeneration()
        {
            // Arrange
            var definition = new CSharpEnumDefinition
            {
                Name = "OperationMode",
                Sets = new List <INameValue>
                {
                    new NameValue {
                        Name = "First", Value = "0"
                    },
                    new NameValue {
                        Name = "Second", Value = "1"
                    },
                    new NameValue {
                        Name = "Third", Value = "2"
                    }
                }
            };

            // Act
            CSharpEnumBuilder.CreateFiles("C:\\Temp\\CatFactory.DotNetCore", string.Empty, true, definition);
        }