public void ProjectOtherwiseElementModify() { var pair = GetNewInMemoryProject("temp.prj"); var xmlPair = new ProjectXmlPair(pair); var choose = xmlPair.AppendNewChaildWithVerify <ProjectChooseElement>(ObjectType.View, "choose", (p, s) => p.CreateChooseElement(), (p, s) => true); var otherwise = choose.AppendNewChaildWithVerify <ProjectOtherwiseElement>(ObjectType.View, "when", (p, s) => p.CreateOtherwiseElement(), (p, s) => true); Assert.Empty(otherwise.View.ChooseElements); otherwise.Append2NewLabeledChildrenWithVerify <ProjectChooseElement>("choose", (p, l) => p.CreateChooseElement(), out var choose1, out var choose2); Assert.Equal(2, otherwise.View.ChooseElements.Count); Assert.Empty(otherwise.View.ItemGroups); otherwise.Append2NewLabeledChildrenWithVerify <ProjectItemGroupElement>("itemGroup", (p, l) => p.CreateItemGroupElement(), out var itemGroup1, out var itemGroup2); Assert.Equal(2, otherwise.View.ItemGroups.Count); Assert.Empty(otherwise.View.PropertyGroups); otherwise.Append2NewLabeledChildrenWithVerify <ProjectPropertyGroupElement>("propGroup", (p, l) => p.CreatePropertyGroupElement(), out var propGroup1, out var propGroup2); Assert.Equal(2, otherwise.View.PropertyGroups.Count); otherwise.Verify(); // will verify all collections. otherwise.View.RemoveChild(choose2.View); Assert.Equal(1, otherwise.View.ChooseElements.Count); otherwise.Real.RemoveChild(choose1.Real); Assert.Empty(otherwise.View.ChooseElements); otherwise.View.RemoveChild(itemGroup2.View); Assert.Equal(1, otherwise.View.ItemGroups.Count); otherwise.View.RemoveChild(propGroup2.View); Assert.Equal(1, otherwise.View.PropertyGroups.Count); otherwise.Verify(); }
public void ProjectExtensionsElementModify() { var pair = GetNewInMemoryProject("temp.prj"); var xmlPair = new ProjectXmlPair(pair); var extensionXml = xmlPair.AppendNewChaildWithVerify <ProjectExtensionsElement>(ObjectType.View, "ext", (p, s) => p.CreateProjectExtensionsElement(), (pe, s) => true); extensionXml.VerifySetter("bla bla bla", (e) => e.Content, (e, v) => e.Content = v); }
public void ProjectSdkElementModify() { var pair = GetNewInMemoryProject("temp.prj"); var xmlPair = new ProjectXmlPair(pair); var sdkElement = xmlPair.AppendNewChaildWithVerify <ProjectSdkElement>(ObjectType.View, "sdk", (p, n) => p.CreateProjectSdkElement(n, "sdkVer"), (s, n) => true); var curiousOfHowToSpecifySdk = xmlPair.View.RawXml; sdkElement.VerifySetter("newVersion", (s) => s.Version, (s, v) => s.Version = v); sdkElement.VerifySetter("newMinVersion", (s) => s.MinimumVersion, (s, v) => s.MinimumVersion = v); sdkElement.VerifySetter("newName", (s) => s.Name, (s, v) => s.Name = v); xmlPair.Verify(); var curiousOfHowToSpecifySdk2 = xmlPair.View.RawXml; }