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