Esempio n. 1
0
        public void ListOfSimpleTypeGDay()
        {
            ItemContainer container = new ItemContainer();
            GDay          day1      = new GDay(1, "Z");
            GDay          day2      = new GDay(9, "+09:00");
            GDay          day3      = new GDay(12, "-01:00");
            Bread         bread     = new Bread
            {
                ID   = Guid.NewGuid().ToString(),
                Gday = new List <GDay>()
                {
                    day1, day2, day3
                }
            };

            container.Items.Add(bread);

            XmlValidation(container.MakeXml());
        }
Esempio n. 2
0
        public void CsharpWritesValidXml()
        {
            Hamburger hamburger = new Hamburger
            {
                ID            = Guid.NewGuid().ToString(),
                Description   = "Large Special",
                HamburgerName = "Four Corners Burger",
                Date          = new DateTime(2017, 9, 2),
                DateTime      = new DateTimeOffset(new DateTime(2017, 9, 2, 13, 23, 32), new TimeSpan(+1, 0, 0))
            };

            Hamburger hamburger2 = new Hamburger
            {
                ID            = Guid.NewGuid().ToString(),
                Description   = "small Special",
                HamburgerName = "Five Corners Burger",
            };

            MultilingualString describe = new MultilingualString
            {
                Language = "eng",
                Content  = "Just a normal cow"
            };
            GMonth    monthG = new GMonth(9, "Z");
            GDay      dayG   = new GDay(6, "+09:00");
            GMonthDay mDay   = new GMonthDay(6, 9, "-12:00");
            Animal    animal = new Animal
            {
                ID   = Guid.NewGuid().ToString(),
                Name = "Cow",
                LingualDescription = new List <MultilingualString> {
                    describe
                },
                CountryOfOrigin = "USA",
                Date            = new DateTime(2017, 6, 9),
                Time            = new DateTimeOffset(2017, 6, 9, 2, 32, 32, new TimeSpan(+1, 0, 0)),
                GMonthDay       = mDay
            };

            List <decimal> heights = new List <decimal> {
                5, 5
            };
            GYearMonth GYM = new GYearMonth(2017, 06, "Z");

            Bread bread = new Bread
            {
                ID          = Guid.NewGuid().ToString(),
                Name        = "Sesame seed bun",
                Description = "freshly baked daily!",
                Size        = new Dimensions {
                    Width = 6, Length = 5.00, Height = heights
                },
                Gyearmonth = GYM
            };

            Bread bread2 = new Bread
            {
                ID          = Guid.NewGuid().ToString(),
                Name        = "Sepcial Bun",
                Description = " a special bun never had before!",
                Size        = new Dimensions {
                    Width = 5, Length = 5.00, Height = heights
                },
                Gyearmonth = GYM
            };

            Roll roll = new Roll
            {
                ID          = Guid.NewGuid().ToString(),
                Name        = "Sesame seed bun",
                Description = "A nice bun"
            };

            Condiment condiment = new Condiment
            {
                ID          = Guid.NewGuid().ToString(),
                Name        = "mustard",
                Description = "special mustard",
                IsSpecial   = true
            };

            Condiment condiment2 = new Condiment
            {
                ID          = Guid.NewGuid().ToString(),
                Name        = "ketchup",
                Description = "normal ketchup",
                IsSpecial   = false
            };

            MeatPatty meatPatty = new MeatPatty
            {
                ID = Guid.NewGuid().ToString()
            };

            MeatPatty meatPatty2 = new MeatPatty
            {
                ID = Guid.NewGuid().ToString()
            };

            VeggiePatty veggiePatty = new VeggiePatty
            {
                ID            = Guid.NewGuid().ToString(),
                VegetableUsed = new List <string> {
                    "red beans", "black beans"
                }
            };

            VeggiePatty veggiePatty2 = new VeggiePatty
            {
                ID            = Guid.NewGuid().ToString(),
                VegetableUsed = new List <string> {
                    "garbonzo beans"
                }
            };

            hamburger.Enclosure  = roll;
            hamburger2.Enclosure = bread;
            hamburger.Patty      = new List <Protein>
            {
                meatPatty,
                meatPatty2
            };
            hamburger2.Patty = new List <Protein> {
                veggiePatty
            };

            ItemContainer container  = new ItemContainer();
            ItemContainer container2 = new ItemContainer();
            ItemContainer container3 = new ItemContainer();
            ItemContainer container4 = new ItemContainer();

            //container
            container.TopLevelReferences.Add(hamburger);
            container.Items.Add(bread);
            container.Items.Add(hamburger);
            container.Items.Add(roll);
            container.Items.Add(meatPatty);
            container.Items.Add(meatPatty2);
            //container 2
            container2.Items.Add(bread2);
            container2.Items.Add(meatPatty);
            //container 3
            container3.Items.Add(condiment);
            container3.Items.Add(condiment2);

            //container 4
            container4.TopLevelReferences.Add(hamburger2);
            container4.Items.Add(hamburger2);
            container4.Items.Add(animal);
            container4.Items.Add(veggiePatty);
            container4.Items.Add(veggiePatty2);
            container4.Items.Add(bread);

            // evaluation
            var containers = new ItemContainer[] { container, container2, container3, container4 };

            for (int i = 0; i < 4; i++)
            {
                XmlValidation(containers[i].MakeXml());
            }
        }