Exemplo n.º 1
0
        public void ExpandAllIntoTaskItems3()
        {
            BuildPropertyGroup pg = new BuildPropertyGroup();

            BuildItemGroup ig = new BuildItemGroup();
            ig.AddItem(new BuildItem("Compile", "foo.cs"));
            ig.AddItem(new BuildItem("Compile", "bar.cs"));

            BuildItemGroup ig2 = new BuildItemGroup();
            ig2.AddItem(new BuildItem("Resource", "bing.resx"));

            Hashtable itemsByType = new Hashtable(StringComparer.OrdinalIgnoreCase);
            itemsByType["Compile"] = ig;
            itemsByType["Resource"] = ig2;

            Expander expander = new Expander(pg, itemsByType);

            List<TaskItem> itemsOut = expander.ExpandAllIntoTaskItems("foo;bar;@(compile);@(resource)", null);

            ObjectModelHelpers.AssertItemsMatch(@"
                foo
                bar
                foo.cs
                bar.cs
                bing.resx
                ", itemsOut.ToArray());
        }
Exemplo n.º 2
0
        public void ExpandAllIntoTaskItems1()
        {
            BuildPropertyGroup pg = new BuildPropertyGroup();
            Expander expander = new Expander(pg);

            List<TaskItem> itemsOut = expander.ExpandAllIntoTaskItems("foo", null);

            ObjectModelHelpers.AssertItemsMatch(@"foo", itemsOut.ToArray());
        }
Exemplo n.º 3
0
        public void ExpandAllIntoTaskItems4()
        {
            BuildPropertyGroup pg = new BuildPropertyGroup();
            pg.SetProperty("a", "aaa");
            pg.SetProperty("b", "bbb");
            pg.SetProperty("c", "cc;dd");

            Expander expander = new Expander(pg);

            List<TaskItem> itemsOut = expander.ExpandAllIntoTaskItems("foo$(a);$(b);$(c)", null);

            ObjectModelHelpers.AssertItemsMatch(@"
                fooaaa
                bbb
                cc
                dd
                ", itemsOut.ToArray());
        }
Exemplo n.º 4
0
        public void ExpandAllIntoTaskItemsComplex()
        {
            ReadOnlyLookup lookup;
            Dictionary<string, string> itemMetadata;
            CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata);

            Expander expander = new Expander(lookup, itemMetadata);

            List<TaskItem> taskItems = expander.ExpandAllIntoTaskItems(
                "@(Resource->'%(Filename)') ; @(Content) ; @(NonExistent) ; $(NonExistent) ; %(NonExistent) ; " +
                "$(OutputPath) ; $(TargetPath) ; %(Language)_%(Culture)", 
                 (new XmlDocument()).CreateAttribute("dummy"));

            // the following items are passed to the TaskItem constructor, and thus their ItemSpecs should be 
            // in escaped form. 
            ObjectModelHelpers.AssertItemsMatch(@"
                string$(p): ddd=444
                dialogs%253b: eee=555
                splash.bmp: ccc=333
                \jk
                l\mno%253bpqr\stu
                subdir1\: aaa=111
                subdir2\: bbb=222
                english_abc%253bdef
                ghi
                ", taskItems.ToArray());
        }