コード例 #1
0
ファイル: XProjectTest.cs プロジェクト: wouterroos/MvsSln
        public void PropertiesTest1()
        {
            var projects = new Dictionary <string, RawText>()
            {
                ["{12B25935-229F-4128-B66B-7561A77ABC54}"] = new RawText(PrjSamplesResource.snet)
            };

            using (var sln = new Sln(SlnItems.EnvWithProjects, new RawText(SlnSamplesResource.regXwild), projects))
            {
                IXProject project = sln.Result.Env.Projects.FirstOrDefault();

                Assert.AreEqual(null, project.GetProperty("NOT_REAL_PROPERTY").name);
                Assert.AreEqual("MyProperty1", project.SetProperty("MyProperty1", "Value1").name);
                Assert.AreEqual("Value1", project.GetProperty("MyProperty1").evaluatedValue);

                Assert.AreEqual(false, project.RemoveProperty("NOT_REAL_PROPERTY_2"));
                Assert.AreEqual(true, project.RemoveProperty("MyProperty1"));
                Assert.AreEqual(null, project.GetProperty("MyProperty1").name);
            }
        }
コード例 #2
0
        internal static void RemoveProperties(this IXProject xp, params string[] names)
        {
            if (xp == null)
            {
                return;
            }

            foreach (string name in names)
            {
                if (!string.IsNullOrWhiteSpace(name))
                {
                    while (xp.RemoveProperty(name, true))
                    {
                    }
                }
            }
            xp.RemoveEmptyPropertyGroups();
        }