1 write to View
Microsoft.Build.Engine.OM.UnitTests (1)
ObjectModelRemoting\Helpers\ViewValidation.cs (1)
27this.View = view;
226 references to View
Microsoft.Build.Engine.OM.UnitTests (226)
ObjectModelRemoting\Helpers\ViewValidation.construction.cs (4)
152foreach (var v in getter(this.View)) 187Assert.True(this.View is ProjectElementContainer); 211public ProjectXmlPair(ProjectPair pair) : base(null, pair.View.Xml, pair.Real.Xml) { this.Project = pair; this.PRE = this; } 217var view = creator(this.View);
ObjectModelRemoting\Helpers\ViewValidation.cs (16)
31public T Get(ObjectType type) => type == ObjectType.Real ? this.Real : this.View; 37Assert.NotEqual((object)this.View, (object)other.View); 43Assert.Equal((object)this.View, (object)other.View); 50Assert.Equal(current, getter(this.View)); 53setter(this.View, !current); 55Assert.Equal(!current, getter(this.View)); 61Assert.Equal(current, getter(this.View)); 64setter(this.View, finalValue); 65Assert.Equal(finalValue, getter(this.View)); 73Assert.Equal(current, getter(this.View)); 78setter(this.View, newValue1); 80Assert.Equal(newValue1, getter(this.View)); 86Assert.Equal(newValue, getter(this.View)); 93ViewValidation.VerifyFindType(this.View, this.Real);
ObjectModelRemoting\Helpers\ViewValidation.evaluation.cs (8)
23Assert.Equal(value, this.View.GetPropertyValue(name)); 69var viewItems = this.View.GetItemsByEvaluatedInclude(evaluatedInclude); 89var view = this.View.GetProperty(name); 123Assert.Same(context.Pair.View, view.Project); 156Assert.Same(context?.Pair.View, view.Project); 200Assert.Same(context?.Pair.View, view.Project); 250Assert.Same(context.Pair.View, view.Project); 329var view = pair.View;
ObjectModelRemoting\LinkedConstructionModify_Tests.cs (161)
85ViewValidation.VerifyMetadata(itemMetadata, (k) => itemWithMetadata1.View.Metadata.Where((md) => md.Name == k).FirstOrDefault().Value); 133var clone = xmlPair.View.DeepClone(); 135Assert.NotSame(clone, xmlPair.View); 181newTarget1.View.Name = NewTargetRenamed; 196newTarget1.View.RemoveChild(newTask2.View); 198Assert.Equal(1, newTarget1.View.Tasks.Count); 200Assert.ThrowsAny<ArgumentException>(() => newTarget1.View.RemoveChild(newTask1.View)); 201Assert.Empty(newTarget1.View.Tasks); 203Assert.NotEmpty(newTarget1.View.ItemGroups); 204Assert.NotEmpty(newTarget1.View.PropertyGroups); 205newTarget1.View.RemoveAllChildren(); 207Assert.Empty(newTarget1.View.ItemGroups); 208Assert.Empty(newTarget1.View.PropertyGroups); 226Assert.Equal(0, newTask.View.Outputs.Count); 229Assert.True(newOutputItem1.View.IsOutputItem); 230Assert.False(newOutputItem1.View.IsOutputProperty); 235Assert.True(newOutputItemWithConfig1.View.IsOutputItem); 236Assert.False(newOutputItemWithConfig1.View.IsOutputProperty); 240Assert.False(newOutputProp1.View.IsOutputItem); 241Assert.True(newOutputProp1.View.IsOutputProperty); 246Assert.False(newOutputPropWithConfig1.View.IsOutputItem); 247Assert.True(newOutputPropWithConfig1.View.IsOutputProperty); 249Assert.Equal(8, newTask.View.Outputs.Count); 256newTask.View.RemoveAllParameters(); 259Assert.Equal(0, newTask.View.Parameters.Count); 269Assert.Equal(5, newTask.View.Parameters.Count); 272Assert.Equal(paramValue.Ver(i), newTask.View.Parameters[paramName.Ver(i)]); 275newTask.View.RemoveParameter(paramName.Ver(1)); 278Assert.Equal(3, newTask.View.Parameters.Count); 281Assert.Equal(paramValue.Ver(i), newTask.View.Parameters[paramName.Ver(i)]); 284Assert.False(newTask.View.Parameters.ContainsKey(paramName.Ver(1))); 286Assert.False(newTask.View.Parameters.ContainsKey(paramName.Ver(5))); 290newTask.View.RemoveAllParameters(); 292Assert.Equal(0, newTask.View.Parameters.Count); 295newTask.View.RemoveChild(newOutputItem2.View); 297Assert.Equal(7, newTask.View.Outputs.Count); 299Assert.ThrowsAny<ArgumentException>(() => newTask.View.RemoveChild(newOutputItem2.View)); 301Assert.Equal(6, newTask.View.Outputs.Count); 304Assert.Equal(5, newTask.View.Outputs.Count); 305newTask.View.RemoveChild(newOutputPropWithConfig2.View); 306Assert.Equal(4, newTask.View.Outputs.Count); 326Assert.True(newOutputItem.View.IsOutputItem); 327Assert.False(newOutputItem.View.IsOutputProperty); 332Assert.False(newOutputProp.View.IsOutputItem); 333Assert.True(newOutputProp.View.IsOutputProperty); 339Assert.ThrowsAny<InvalidOperationException>(() => newOutputProp.View.ItemType = "foo"); 342Assert.ThrowsAny<InvalidOperationException>(() => newOutputItem.View.PropertyName = "foo"); 373xmlPair.View.AppendChild(chooseCreataed.View); 376Assert.Same(choose.View, chooseCreataed.View); 381Assert.ThrowsAny<InvalidOperationException>(() => choose.View.Condition = "ccc"); 383Assert.Empty(choose.View.WhenElements); 385Assert.Equal(2, choose.View.WhenElements.Count); 386when1.VerifySame(choose.QuerySingleChildrenWithValidation<ProjectWhenElement>((ch) => ch.Label == when1.View.Label)); 387when2.VerifySame(choose.QuerySingleChildrenWithValidation<ProjectWhenElement>((ch) => ch.Label == when2.View.Label)); 389Assert.Null(choose.View.OtherwiseElement); 392Assert.Same(otherWise.View, choose.View.OtherwiseElement); 397choose.View.RemoveChild(when2.View); 398Assert.Equal(1, choose.View.WhenElements.Count); 399when1.VerifySame(choose.QuerySingleChildrenWithValidation<ProjectWhenElement>((ch) => ch.Label == when1.View.Label)); 401choose.View.RemoveChild(otherWise.View); 402Assert.Null(choose.View.OtherwiseElement); 417Assert.Empty(when.View.ChooseElements); 419Assert.Equal(2, when.View.ChooseElements.Count); 421Assert.Empty(when.View.ItemGroups); 423Assert.Equal(2, when.View.ItemGroups.Count); 425Assert.Empty(when.View.PropertyGroups); 427Assert.Equal(2, when.View.PropertyGroups.Count); 431when.View.RemoveChild(choose2.View); 432Assert.Equal(1, when.View.ChooseElements.Count); 434Assert.Empty(when.View.ChooseElements); 436when.View.RemoveChild(itemGroup2.View); 437Assert.Equal(1, when.View.ItemGroups.Count); 439when.View.RemoveChild(propGroup2.View); 440Assert.Equal(1, when.View.PropertyGroups.Count); 455Assert.Empty(otherwise.View.ChooseElements); 457Assert.Equal(2, otherwise.View.ChooseElements.Count); 459Assert.Empty(otherwise.View.ItemGroups); 461Assert.Equal(2, otherwise.View.ItemGroups.Count); 463Assert.Empty(otherwise.View.PropertyGroups); 465Assert.Equal(2, otherwise.View.PropertyGroups.Count); 469otherwise.View.RemoveChild(choose2.View); 470Assert.Equal(1, otherwise.View.ChooseElements.Count); 472Assert.Empty(otherwise.View.ChooseElements); 474otherwise.View.RemoveChild(itemGroup2.View); 475Assert.Equal(1, otherwise.View.ItemGroups.Count); 477otherwise.View.RemoveChild(propGroup2.View); 478Assert.Equal(1, otherwise.View.PropertyGroups.Count); 496Assert.ThrowsAny<InvalidOperationException>(() => usingTaskFile.View.AssemblyName = "xxx"); 499Assert.Null(usingTaskFile.View.TaskBody); 501Assert.Same(body.View, usingTaskFile.View.TaskBody); 504Assert.Null(usingTaskFile.View.ParameterGroup); 506Assert.Same(pg.View, usingTaskFile.View.ParameterGroup); 510xmlPair.View.RemoveChild(usingTaskFile.View); 514Assert.ThrowsAny<InvalidOperationException>(() => usingTaskName.View.AssemblyFile = "xxx"); 542Assert.Empty(taskParamGroup.View.Parameters); 545Assert.Equal(2, taskParamGroup.View.Parameters.Count); 547Assert.Equal(4, taskParamGroup.View.Parameters.Count); 600Assert.Empty(importGroup.View.Imports); 603Assert.Equal(2, importGroup.View.Imports.Count); 612Assert.Equal("source", itemDef.View.ItemType); 614Assert.Empty(itemDef.View.Metadata); 617Assert.Equal(2, itemDef.View.Metadata.Count); 619Assert.Equal(4, itemDef.View.Metadata.Count); 622Assert.Equal(6, itemDef.View.Metadata.Count); 632Assert.Empty(itemDefGrp.View.ItemDefinitions); 634Assert.Equal(2, itemDefGrp.View.ItemDefinitions.Count); 653Assert.ThrowsAny<InvalidOperationException>(() => item.View.Remove = "xx"); // Include/Update/Remove are exclusive 654Assert.ThrowsAny<InvalidOperationException>(() => item.View.Update = "xx"); // Include/Update/Remove are exclusive 655item.View.Include = null; 657Assert.ThrowsAny<InvalidOperationException>(() => item.View.Include = "xx"); // Include/Update/Remove are exclusive 658Assert.ThrowsAny<InvalidOperationException>(() => item.View.Update = "xx"); // Include/Update/Remove are exclusive 659item.View.Remove = null; 661Assert.ThrowsAny<InvalidOperationException>(() => item.View.Include = "xx"); // Include/Update/Remove are exclusive 662Assert.ThrowsAny<InvalidOperationException>(() => item.View.Remove = "xx"); // Include/Update/Remove are exclusive 665Assert.ThrowsAny<InvalidOperationException>(() => item.View.KeepMetadata = "xx"); 666Assert.ThrowsAny<InvalidOperationException>(() => item.View.KeepDuplicates = "xx"); 667Assert.ThrowsAny<InvalidOperationException>(() => item.View.RemoveMetadata = "xx"); 669Assert.False(item.View.HasMetadata); 670Assert.Empty(item.View.Metadata); 673Assert.Equal(2, item.View.Metadata.Count); 675Assert.Equal(4, item.View.Metadata.Count); 677Assert.Equal(6, item.View.Metadata.Count); 683Assert.ThrowsAny<InvalidOperationException>(() => itemInTargt.View.RemoveMetadata = "xx"); // RemoveMetadata/KeepDuplicate exclusive 684itemInTargt.View.KeepMetadata = null; 686Assert.ThrowsAny<InvalidOperationException>(() => itemInTargt.View.KeepMetadata = "xx"); // RemoveMetadata/KeepDuplicate exclusive 696Assert.Empty(itemGrp.View.Items); 698Assert.Equal(2, itemGrp.View.Items.Count); 706Assert.Equal(4, itemGrp.View.Items.Count); 707ViewValidation.VerifyMetadata(itemMetadata, (k) => itemWithMetadata1.View.Metadata.Where((md) => md.Name == k).FirstOrDefault().Value); 708ViewValidation.VerifyMetadata(itemMetadata, (k) => itemWithMetadata2.View.Metadata.Where((md) => md.Name == k).FirstOrDefault().Value); 731Assert.Empty(propGrp.View.Properties); 732Assert.Empty(propGrp.View.PropertiesReversed); 735Assert.Equal(2, propGrp.View.Properties.Count); 736Assert.Equal(2, propGrp.View.PropertiesReversed.Count); 739Assert.Equal(4, propGrp.View.Properties.Count); 740Assert.Equal(4, propGrp.View.PropertiesReversed.Count); 743Assert.Equal(6, propGrp.View.Properties.Count); 744Assert.Equal(6, propGrp.View.PropertiesReversed.Count); 749Assert.Equal(6, propGrp.View.Properties.Count); 750Assert.Equal(6, propGrp.View.PropertiesReversed.Count); 762var curiousOfHowToSpecifySdk = xmlPair.View.RawXml; 769var curiousOfHowToSpecifySdk2 = xmlPair.View.RawXml;
ObjectModelRemoting\LinkedEvaluationModify_Tests.cs (14)
171pair.View.RemoveItem(barWithMetadataViewFast); 188pair.View.RemoveItems(toRemoveView); 205pair.View.RemoveItem(fooWithMetadataRealFast); 223pair.View.RemoveItems(toRemoveReal); 315Assert.False(pair.View.GlobalProperties.ContainsKey("gp1")); 316Assert.False(pair.View.GlobalProperties.ContainsKey("Configuration")); 320pair.View.SetGlobalProperty("gp1", "GP1V"); 321Assert.True(pair.View.GlobalProperties.ContainsKey("gp1")); 326pair.View.ReevaluateIfNecessary(); 331Assert.True(pair.View.GlobalProperties.ContainsKey("Configuration")); 333pair.View.ReevaluateIfNecessary(); 364var fooViewNew = pair.View.GetProperty("fooProp"); 379Assert.True(pair.View.RemoveProperty(fooView)); 380Assert.Null(pair.View.GetProperty("fooProp"));
ObjectModelRemoting\LinkedSpecialCasesScenarios.cs (23)
97Assert.True(xmlPair.View.HasUnsavedChanges); 98xmlPair.View.Save(); 99Assert.False(xmlPair.View.HasUnsavedChanges); 101sourceProject ??= xmlPair.View; 119Assert.ThrowsAny<InvalidOperationException>(() => xmlPair.View.AppendChild(cloned)); 126xmlPair.View.AppendChild(cloned); 127Assert.True(xmlPair.View.HasUnsavedChanges); 130clonedPair.VerifySame(xmlPair.QuerySingleChildrenWithValidation<ProjectItemGroupElement>((ig) => ig == clonedPair.View || ig == clonedPair.Real)); 151Assert.True(xmlPair.View.HasUnsavedChanges); 152xmlPair.View.Save(); 153Assert.False(xmlPair.View.HasUnsavedChanges); 155sourceProject ??= xmlPair.View; 167newCopyFrom.View.CopyFrom(existingItemGroup); 169newCopyFrom.View.Label = "CopyFrom"; 173Assert.Empty(newCopyFrom.View.Items); 180Assert.True(xmlPair.View.HasUnsavedChanges); 184newDeepCopy.View.DeepCopyFrom(existingItemGroup); 194ViewValidation.Verify(newDeepCopy.View, realExistingItemGroup, context); 195newDeepCopy.View.Label = "DeepCopyFrom"; 213CloneAndAddInternal(this.StdGroup.TargetXmlPair.View); 227CloneAndAddInternal(this.StdGroup.GuestXmlPair.View); 240CopyFromInternal(this.StdGroup.TargetXmlPair.View); 252CopyFromInternal(this.StdGroup.GuestXmlPair.View);