public void Contains_WithExistentProperty_ShouldReturnTrue()
        {
            string inputValue = "<PropertyGroup><Test>Content</Test></PropertyGroup>";

            MsBuildXmlPropertyGroupImplementation propertyGroupImplementation =
                new MsBuildXmlPropertyGroupImplementation(CreateFromString(inputValue));

            IMsBuildProperty property = propertyGroupImplementation.First();

            Assert.IsTrue(propertyGroupImplementation.Contains(property));
        }
コード例 #2
0
        Load_FromExistentTestFileWithTargetImplementingComplexConditionalOverwritableProperty_ShouldReturnProjectContainingTargetWithOverwritableProperty()
        {
            IMsBuildProject projectFile = MsBuildProjectFile.Load("TestData/ProjectFiles/TargetWithProperties.tcsproj");

            IMsBuildTarget target = projectFile.GetChildren <IMsBuildTarget>()
                                    .First(t => t.Name.Equals("WithComplexConditionalOverwritableProperty"));

            IMsBuildProperty overwritableProperty =
                target.GetChildren <IMsBuildPropertyGroup>().First().GetChildren <IMsBuildProperty>()
                .First(p => p.Name.Equals("OverwritableProperty"));

            Assert.AreEqual(true, overwritableProperty.HasPublicSetter);
        }
        public void CopyTo_Array_ShouldCopyAllValuesToArray()
        {
            string inputValue = "<PropertyGroup></PropertyGroup>";

            IMsBuildProperty[] array = new IMsBuildProperty[20];

            MsBuildXmlPropertyGroupImplementation propertyGroupImplementation =
                new MsBuildXmlPropertyGroupImplementation(CreateFromString(inputValue));

            for (int i = 0; i <= 10; i++)
            {
                Mock <IMsBuildProperty> mock = new Mock <IMsBuildProperty>();
                mock.Setup(m => m.Value).Returns($"OverwrittenContent{i}");
                mock.Setup(m => m.Name).Returns($"OverwrittenTest{i}");

                propertyGroupImplementation.Add(mock.Object);
            }

            propertyGroupImplementation.CopyTo(array, 0);

            Assert.AreEqual("OverwrittenContent0", array[0].Value);
        }
コード例 #4
0
 public void Insert(int index, IMsBuildProperty item)
 {
     _properties.Insert(index, item);
 }
コード例 #5
0
 public int IndexOf(IMsBuildProperty item)
 {
     return(_properties.IndexOf(item));
 }
コード例 #6
0
 public bool Remove(IMsBuildProperty item)
 {
     return(_properties.Remove(item));
 }
コード例 #7
0
 public bool Contains(IMsBuildProperty item)
 {
     return(_properties.Contains(item));
 }
コード例 #8
0
 public void Add(IMsBuildProperty item)
 {
     _properties.Add(item);
 }