Esempio n. 1
0
 public LinkPair(T view, T real)
 {
     ViewValidation.VerifyLinkedNotNull(view);
     ViewValidation.VerifyNotLinkedNotNull(real);
     this.View = view;
     this.Real = real;
 }
Esempio n. 2
0
        public static void Verify(ProjectUsingTaskElement viewXml, ProjectUsingTaskElement realXml, ValidationContext context = null)
        {
            if (viewXml == null && realXml == null)
            {
                return;
            }
            VerifyProjectElement(viewXml, realXml, context);


            Assert.Equal(realXml.AssemblyFile, viewXml.AssemblyFile);
            ViewValidation.VerifySameLocation(realXml.AssemblyFileLocation, viewXml.AssemblyFileLocation, context);

            Assert.Equal(realXml.AssemblyName, viewXml.AssemblyName);
            ViewValidation.VerifySameLocation(realXml.AssemblyNameLocation, viewXml.AssemblyNameLocation, context);

            Assert.Equal(realXml.TaskName, viewXml.TaskName);
            ViewValidation.VerifySameLocation(realXml.TaskNameLocation, viewXml.TaskNameLocation, context);

            Assert.Equal(realXml.TaskFactory, viewXml.TaskFactory);
            ViewValidation.VerifySameLocation(realXml.TaskFactoryLocation, viewXml.TaskFactoryLocation, context);

            Assert.Equal(realXml.Runtime, viewXml.Runtime);
            ViewValidation.VerifySameLocation(realXml.RuntimeLocation, viewXml.RuntimeLocation, context);

            Assert.Equal(realXml.Architecture, viewXml.Architecture);
            ViewValidation.VerifySameLocation(realXml.ArchitectureLocation, viewXml.ArchitectureLocation, context);

            ViewValidation.Verify(viewXml.TaskBody, realXml.TaskBody, context);
            ViewValidation.Verify(viewXml.ParameterGroup, realXml.ParameterGroup, context);
        }
        public void ProjectRootElemetReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            ViewValidation.Verify(preView, preReal);
        }
Esempio n. 4
0
        public static ElementLinkPair <CT> CreateFromView <CT>(CT view, ProjectXmlPair pre = null)
            where CT : ProjectElement
        {
            var real = ViewValidation.GetRealObject(view);

            return(new ElementLinkPair <CT>(pre, view, real));
        }
Esempio n. 5
0
        public static void Verify(ProjectTargetElement viewXml, ProjectTargetElement realXml, ValidationContext context = null)
        {
            if (viewXml == null && realXml == null)
            {
                return;
            }
            VerifyProjectElement(viewXml, realXml, context);


            Assert.Equal(realXml.Name, viewXml.Name);
            ViewValidation.VerifySameLocation(realXml.NameLocation, viewXml.NameLocation, context);
            Assert.Equal(realXml.Inputs, viewXml.Inputs);
            ViewValidation.VerifySameLocation(realXml.InputsLocation, viewXml.InputsLocation, context);
            Assert.Equal(realXml.Outputs, viewXml.Outputs);
            ViewValidation.VerifySameLocation(realXml.OutputsLocation, viewXml.OutputsLocation, context);
            Assert.Equal(realXml.KeepDuplicateOutputs, viewXml.KeepDuplicateOutputs);
            ViewValidation.VerifySameLocation(realXml.KeepDuplicateOutputsLocation, viewXml.KeepDuplicateOutputsLocation, context);
            Assert.Equal(realXml.DependsOnTargets, viewXml.DependsOnTargets);
            ViewValidation.VerifySameLocation(realXml.DependsOnTargetsLocation, viewXml.DependsOnTargetsLocation, context);
            Assert.Equal(realXml.BeforeTargets, viewXml.BeforeTargets);
            ViewValidation.VerifySameLocation(realXml.BeforeTargetsLocation, viewXml.BeforeTargetsLocation, context);
            Assert.Equal(realXml.AfterTargets, viewXml.AfterTargets);
            ViewValidation.VerifySameLocation(realXml.AfterTargetsLocation, viewXml.AfterTargetsLocation, context);
            Assert.Equal(realXml.Returns, viewXml.Returns);
            ViewValidation.VerifySameLocation(realXml.ReturnsLocation, viewXml.ReturnsLocation, context);

            ViewValidation.Verify(viewXml.ItemGroups, realXml.ItemGroups, ViewValidation.Verify, context);
            ViewValidation.Verify(viewXml.PropertyGroups, realXml.PropertyGroups, ViewValidation.Verify, context);
            ViewValidation.Verify(viewXml.OnErrors, realXml.OnErrors, ViewValidation.Verify, context);
            ViewValidation.Verify(viewXml.Tasks, realXml.Tasks, ViewValidation.Verify, context);
        }
Esempio n. 6
0
        public void CrossLinked()
        {
            this.StdGroup.Local.Importing = true;
            Array.ForEach(StdGroup.Remote, (r) => r.Importing = true);

            Assert.Equal(0, this.StdGroup.Local.Collection.LoadedProjects.Count);
            Assert.Equal(0, this.StdGroup.Remote[0].Collection.LoadedProjects.Count);
            Assert.Equal(0, this.StdGroup.Remote[1].Collection.LoadedProjects.Count);

            this.StdGroup.Local.LoadProject(this.StdGroup.StdProjectFiles[0]);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Local.Collection.LoadedProjects, 1, 0);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[0].Collection.LoadedProjects, 0, 1);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[1].Collection.LoadedProjects, 0, 1);
            this.StdGroup.Local.VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 1, 0);
            this.StdGroup.Remote[0].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 0, 1);
            this.StdGroup.Remote[1].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 0, 1);

            this.StdGroup.Local.LoadProject(this.StdGroup.StdProjectFiles[1]);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Local.Collection.LoadedProjects, 2, 0);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[0].Collection.LoadedProjects, 0, 2);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[1].Collection.LoadedProjects, 0, 2);
            this.StdGroup.Local.VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[1], 1, 0);
            this.StdGroup.Remote[0].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[1], 0, 1);
            this.StdGroup.Remote[1].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[1], 0, 1);

            this.StdGroup.Remote[0].LoadProject(this.StdGroup.StdProjectFiles[2]);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Local.Collection.LoadedProjects, 2, 1);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[0].Collection.LoadedProjects, 1, 2);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[1].Collection.LoadedProjects, 0, 3);
            this.StdGroup.Local.VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[2], 0, 1);
            this.StdGroup.Remote[0].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[2], 1, 0);
            this.StdGroup.Remote[1].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[2], 0, 1);

            // load proj0 in remote[1] (already loaded in local)
            this.StdGroup.Remote[1].LoadProject(this.StdGroup.StdProjectFiles[0]);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Local.Collection.LoadedProjects, 2, 2);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[0].Collection.LoadedProjects, 1, 3);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[1].Collection.LoadedProjects, 1, 3);
            this.StdGroup.Local.VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 1, 1);
            this.StdGroup.Remote[0].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 0, 2);
            this.StdGroup.Remote[1].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 1, 1);

            this.StdGroup.Local.Collection.UnloadAllProjects();

            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Local.Collection.LoadedProjects, 0, 2);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[0].Collection.LoadedProjects, 1, 1);
            ViewValidation.VerifyProjectCollectionLinks(this.StdGroup.Remote[1].Collection.LoadedProjects, 1, 1);
            this.StdGroup.Local.VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 0, 1);
            this.StdGroup.Remote[0].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 0, 1);
            this.StdGroup.Remote[1].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[0], 1, 0);

            this.StdGroup.Local.VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[1], 0, 0);
            this.StdGroup.Remote[0].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[1], 0, 0);
            this.StdGroup.Remote[1].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[1], 0, 0);

            this.StdGroup.Local.VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[2], 0, 1);
            this.StdGroup.Remote[0].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[2], 1, 0);
            this.StdGroup.Remote[1].VerifyProjectCollectionLinks(this.StdGroup.StdProjectFiles[2], 0, 1);
        }
Esempio n. 7
0
        public void ProjectPropertiesReadOnly_Tests()
        {
            var viewProperties = this.StdGroup.View.Properties;
            var realProperties = this.StdGroup.Real.Properties;

            Assert.NotEmpty(viewProperties);
            ViewValidation.Verify(viewProperties, realProperties);
        }
Esempio n. 8
0
        public void ProjectMetadataReadOnly_Tests()
        {
            var viewMetadata = this.StdGroup.View.AllEvaluatedItemDefinitionMetadata;
            var realMetadata = this.StdGroup.Real.AllEvaluatedItemDefinitionMetadata;

            Assert.NotEmpty(viewMetadata);
            ViewValidation.Verify(viewMetadata, realMetadata);
        }
Esempio n. 9
0
        public void ProjectItemReadOnly_Tests()
        {
            var viewItems = this.StdGroup.View.AllEvaluatedItems;
            var realItems = this.StdGroup.Real.AllEvaluatedItems;

            Assert.NotEmpty(viewItems);
            ViewValidation.Verify(viewItems, realItems);
        }
Esempio n. 10
0
        public void ProjectItemDefinitionReadOnly_Tests()
        {
            var viewItemDefinitions = this.StdGroup.View.ItemDefinitions;
            var realItemDefinitions = this.StdGroup.Real.ItemDefinitions;

            Assert.NotEmpty(viewItemDefinitions);
            ViewValidation.Verify(viewItemDefinitions, realItemDefinitions, ViewValidation.Verify);
        }
Esempio n. 11
0
        public void ProjectChooseElementReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            Assert.NotEmpty(preReal.ChooseElements);

            ViewValidation.Verify(preView.ChooseElements, preReal.ChooseElements, ViewValidation.Verify);
        }
Esempio n. 12
0
        public static void Verify(ProjectItemDefinitionGroupElement viewXml, ProjectItemDefinitionGroupElement realXml, ValidationContext context = null)
        {
            if (viewXml == null && realXml == null)
            {
                return;
            }
            VerifyProjectElement(viewXml, realXml, context);

            ViewValidation.Verify(viewXml.ItemDefinitions, realXml.ItemDefinitions, ViewValidation.Verify, context);
        }
Esempio n. 13
0
        public void ProjectItemElementReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            var realItems  = preReal.Items.ToList();
            var viewlItems = preView.Items.ToList();

            Assert.NotEmpty(realItems);
            ViewValidation.Verify(viewlItems, realItems, ViewValidation.Verify);
        }
Esempio n. 14
0
        public void ProjectPropertyGroupElementReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            var realPropertieGroups = preReal.PropertyGroups.ToList();
            var viewPropertieGroups = preView.PropertyGroups.ToList();

            Assert.NotEmpty(realPropertieGroups);
            ViewValidation.Verify(viewPropertieGroups, realPropertieGroups, ViewValidation.Verify);
        }
Esempio n. 15
0
        public void ProjectTargetElementReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            var realCollection = preReal.Targets.ToList();
            var viewCollection = preView.Targets.ToList();

            Assert.NotEmpty(realCollection);  // to ensure we actually have some elements in test project
            ViewValidation.Verify(viewCollection, realCollection, ViewValidation.Verify);
        }
Esempio n. 16
0
        public void ProjectUsingTaskElementReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            var realCollection = preReal.AllChildren.OfType <ProjectUsingTaskElement>().ToList();
            var viewCollection = preView.AllChildren.OfType <ProjectUsingTaskElement>().ToList();

            Assert.NotEmpty(realCollection); // to ensure we actually have some elements in test project
            ViewValidation.Verify(viewCollection, realCollection, ViewValidation.Verify);
        }
Esempio n. 17
0
        public void ProjectOutputElementReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            var realCollection = preReal.AllChildren.OfType <ProjectOutputElement>().ToList();
            var viewCollection = preView.AllChildren.OfType <ProjectOutputElement>().ToList();

            Assert.NotEmpty(realCollection);
            ViewValidation.Verify(viewCollection, realCollection, ViewValidation.Verify);
        }
Esempio n. 18
0
        public static void Verify(ProjectItemDefinitionElement viewXml, ProjectItemDefinitionElement realXml, ValidationContext context = null)
        {
            if (viewXml == null && realXml == null)
            {
                return;
            }
            VerifyProjectElement(viewXml, realXml, context);

            Assert.Equal(realXml.ItemType, viewXml.ItemType);
            ViewValidation.Verify(viewXml.Metadata, realXml.Metadata, ViewValidation.Verify, context);
        }
Esempio n. 19
0
            public void ResetBeforeTests()
            {
                this.Group.ClearAllRemotes();

                var projView = this.Local.GetLoadedProjects(this.BigFile).FirstOrDefault();

                Assert.NotNull(projView);
                Assert.NotSame(projView, this.View);
                this.View = projView;

                ViewValidation.VerifyLinkedNotNull(this.View);
            }
Esempio n. 20
0
        public ElementLinkPair <CT> CreateWithVerify <CT>(Func <ProjectRootElement, CT> creator)
            where CT : ProjectElement
        {
            var view = creator(this.View);

            Assert.NotNull(view);
            var real = creator(this.Real);

            Assert.NotNull(real);
            ViewValidation.VerifyFindType(view, real);
            return(new ElementLinkPair <CT>(this, view, real));
        }
Esempio n. 21
0
        private void CloneAndAddInternal(ProjectRootElement sourceProject)
        {
            bool externalSource = sourceProject != null;

            var projectPair = GetNewInMemoryProject("Clone", TestCollectionGroup.BigProjectFile);
            var xmlPair     = new ProjectXmlPair(projectPair);

            Assert.True(xmlPair.View.HasUnsavedChanges);
            xmlPair.View.Save();
            Assert.False(xmlPair.View.HasUnsavedChanges);

            sourceProject = sourceProject ?? xmlPair.View;


            // var existingItemGroup1 = sourceProject.QuerySingleChildrenWithValidation<ProjectItemGroupElement>((ig) => ig.Label == "Group1");
            var existingItemGroupList = sourceProject.AllChildren.OfType <ProjectItemGroupElement>().Where(((ig) => ig.Label == "Group1")).ToList();

            Assert.Single(existingItemGroupList);
            var existingItemGroup = existingItemGroupList[0];

            var cloned = (ProjectItemGroupElement)existingItemGroup.Clone();

            Assert.NotSame(cloned, existingItemGroup);
            Assert.False(sourceProject.HasUnsavedChanges);

            var sourceIsALink = ViewValidation.IsLinkedObject(sourceProject);

            ViewValidation.VerifyNotNull(cloned, sourceIsALink);


            if (externalSource)
            {
                Assert.ThrowsAny <InvalidOperationException>(() => xmlPair.View.AppendChild(cloned));
            }
            else
            {
                var clonedPair = xmlPair.CreateFromView(cloned);
                xmlPair.QueryChildrenWithValidation <ProjectItemGroupElement>((ig) => ig == cloned || ig == clonedPair.Real, 0);

                xmlPair.View.AppendChild(cloned);
                Assert.True(xmlPair.View.HasUnsavedChanges);
                Assert.True(xmlPair.Real.HasUnsavedChanges);

                clonedPair.VerifySame(xmlPair.QuerySingleChildrenWithValidation <ProjectItemGroupElement>((ig) => ig == clonedPair.View || ig == clonedPair.Real));
                xmlPair.QueryChildrenWithValidation <ProjectItemGroupElement>((ig) => ig.Label == "Group1", 2);

                clonedPair.VerifySetter("Group2", (g) => g.Label, (g, v) => g.Label = v);
                xmlPair.Verify();

                Assert.Equal("Group1", existingItemGroup.Label);
            }
        }
Esempio n. 22
0
        public ProjectItem GetSingleItemWithVerify(ObjectType which, string evaluatedInclude)
        {
            var realItems = this.Real.GetItemsByEvaluatedInclude(evaluatedInclude);
            var viewItems = this.View.GetItemsByEvaluatedInclude(evaluatedInclude);

            ViewValidation.Verify(viewItems, realItems, ViewValidation.Verify, new ValidationContext(this));
            if (viewItems == null || viewItems.Count == 0)
            {
                return(null);
            }
            Assert.Equal(1, viewItems.Count);
            return(which == ObjectType.View ? viewItems.First() : realItems.First());
        }
Esempio n. 23
0
        private ProjectPair GetNewInMemoryProject(string path)
        {
            var tempPath = this.StdGroup.Disk.GetAbsolutePath(path);
            var newReal  = this.StdGroup.Target.LoadInMemoryWithSettings(TestCollectionGroup.SampleProjectFile);

            newReal.Xml.FullPath = tempPath;
            var newView = this.StdGroup.Local.GetLoadedProjects(tempPath).FirstOrDefault();

            Assert.NotNull(newView);

            ViewValidation.Verify(newView, newReal);

            return(new ProjectPair(newView, newReal));
        }
Esempio n. 24
0
        public ProjectProperty SetPropertyWithVerify(ObjectType where, string name, string unevaluatedValue)
        {
            var toAdd = this.Get(where);
            var added = toAdd.SetProperty(name, unevaluatedValue);

            Assert.NotNull(added);
            Assert.Same(added, toAdd.GetProperty(name));
            Assert.Equal(unevaluatedValue, added.UnevaluatedValue);

            var view = this.View.GetProperty(name);
            var real = this.Real.GetProperty(name);

            ViewValidation.Verify(view, real, new ValidationContext(this));

            return(added);
        }
Esempio n. 25
0
        public void ProjectPropertyModify()
        {
            var pcLocal  = this.StdGroup.Local;
            var pcRemote = this.StdGroup.Remote[0];

            var proj1Path = this.StdGroup.StdProjectFiles[0];
            var realProj  = pcRemote.LoadProject(proj1Path);

            pcLocal.Importing = true;
            var viewProj = pcLocal.Collection.GetLoadedProjects(proj1Path).FirstOrDefault();

            ProjectPair pair = new ProjectPair(viewProj, realProj);

            ViewValidation.Verify(pair);

            pair.ValidatePropertyValue("fooProp", string.Empty);

            var fooView = pair.SetPropertyWithVerify(ObjectType.View, "fooProp", "fooValue$(xxx)");
            var fooReal = pair.Real.GetProperty("fooProp");

            Assert.Equal("fooValue", fooView.EvaluatedValue);
            pair.Real.SetGlobalProperty("xxx", "XXX");
            Assert.Equal("fooValue", fooView.EvaluatedValue);
            pair.Real.ReevaluateIfNecessary();
            // note msbuild create a new property objects on reevaluation.
            Assert.Equal("fooValue", fooView.EvaluatedValue);
            Assert.Equal("fooValue", fooReal.EvaluatedValue);
            var fooRealNew = pair.Real.GetProperty("fooProp");
            var fooViewNew = pair.View.GetProperty("fooProp");

            Assert.NotSame(fooReal, fooRealNew);
            Assert.NotSame(fooView, fooViewNew);

            Assert.Equal("fooValueXXX", fooViewNew.EvaluatedValue);

            fooViewNew.UnevaluatedValue = "fooValueChanged$(xxx)";
            Assert.Equal("fooValueChanged$(xxx)", fooRealNew.UnevaluatedValue);
            // but when changing the Unevaluate via ProjectProp element it does update the live object.
            Assert.Equal("fooValueChangedXXX", fooViewNew.EvaluatedValue);
            Assert.Equal("fooValueChangedXXX", fooRealNew.EvaluatedValue);

            ViewValidation.Verify(pair);

            // note this should work even though the fooView is recycled.
            Assert.True(pair.View.RemoveProperty(fooView));
            Assert.Null(pair.View.GetProperty("fooProp"));
        }
Esempio n. 26
0
        public static void Verify(ProjectRootElement viewXml, ProjectRootElement realXml, ValidationContext context = null)
        {
            if (viewXml == null && realXml == null)
            {
                return;
            }
            VerifyProjectElement(viewXml, realXml, context);

            Assert.Equal(realXml.FullPath, viewXml.FullPath);
            Assert.Equal(realXml.DirectoryPath, viewXml.DirectoryPath);
            Assert.Equal(realXml.Encoding, viewXml.Encoding);
            Assert.Equal(realXml.DefaultTargets, viewXml.DefaultTargets);
            Assert.Equal(realXml.InitialTargets, viewXml.InitialTargets);
            Assert.Equal(realXml.Sdk, viewXml.Sdk);
            Assert.Equal(realXml.TreatAsLocalProperty, viewXml.TreatAsLocalProperty);
            Assert.Equal(realXml.ToolsVersion, viewXml.ToolsVersion);
            Assert.Equal(realXml.HasUnsavedChanges, viewXml.HasUnsavedChanges);
            Assert.Equal(realXml.PreserveFormatting, viewXml.PreserveFormatting);
            Assert.Equal(realXml.Version, viewXml.Version);
            Assert.Equal(realXml.TimeLastChanged, viewXml.TimeLastChanged);
            Assert.Equal(realXml.LastWriteTimeWhenRead, viewXml.LastWriteTimeWhenRead);

            ViewValidation.VerifySameLocation(realXml.ProjectFileLocation, viewXml.ProjectFileLocation, context);
            ViewValidation.VerifySameLocation(realXml.ToolsVersionLocation, viewXml.ToolsVersionLocation, context);
            ViewValidation.VerifySameLocation(realXml.DefaultTargetsLocation, viewXml.DefaultTargetsLocation, context);
            ViewValidation.VerifySameLocation(realXml.InitialTargetsLocation, viewXml.InitialTargetsLocation, context);
            ViewValidation.VerifySameLocation(realXml.SdkLocation, viewXml.SdkLocation, context);
            ViewValidation.VerifySameLocation(realXml.TreatAsLocalPropertyLocation, viewXml.TreatAsLocalPropertyLocation, context);

            ViewValidation.Verify(viewXml.ChooseElements, realXml.ChooseElements, Verify, context);
            ViewValidation.Verify(viewXml.ItemDefinitionGroups, realXml.ItemDefinitionGroups, Verify, context);
            ViewValidation.Verify(viewXml.ItemDefinitions, realXml.ItemDefinitions, Verify, context);
            ViewValidation.Verify(viewXml.ItemGroups, realXml.ItemGroups, Verify, context);
            ViewValidation.Verify(viewXml.Items, realXml.Items, Verify, context);
            ViewValidation.Verify(viewXml.ImportGroups, realXml.ImportGroups, Verify, context);
            ViewValidation.Verify(viewXml.Imports, realXml.Imports, Verify, context);
            ViewValidation.Verify(viewXml.PropertyGroups, realXml.PropertyGroups, Verify, context);
            ViewValidation.Verify(viewXml.Properties, realXml.Properties, Verify, context);
            ViewValidation.Verify(viewXml.Targets, realXml.Targets, Verify, context);
            ViewValidation.Verify(viewXml.UsingTasks, realXml.UsingTasks, Verify, context);
            ViewValidation.Verify(viewXml.ItemGroupsReversed, realXml.ItemGroupsReversed, Verify, context);
            ViewValidation.Verify(viewXml.ItemDefinitionGroupsReversed, realXml.ItemDefinitionGroupsReversed, Verify, context);
            ViewValidation.Verify(viewXml.ImportGroupsReversed, realXml.ImportGroupsReversed, Verify, context);
            ViewValidation.Verify(viewXml.PropertyGroupsReversed, realXml.PropertyGroupsReversed, Verify, context);
        }
Esempio n. 27
0
            public ROTestCollectionGroup()
                : base(1, 0)
            {
                this.BigFile = this.ImmutableDisk.WriteProjectFile($"Big.proj", TestCollectionGroup.BigProjectFile);
                var projReal = this.Remote[0].LoadProjectIgnoreMissingImports(this.BigFile);

                this.Local.Importing = true;
                Assert.NotNull(projReal);
                this.RealXml = projReal.Xml;
                Assert.NotNull(this.RealXml);
                var projView = this.Local.GetLoadedProjects(this.BigFile).FirstOrDefault();

                Assert.NotNull(projView);
                this.ViewXml = projView.Xml;

                ViewValidation.VerifyNotLinkedNotNull(this.RealXml);
                ViewValidation.VerifyLinkedNotNull(this.ViewXml);
            }
Esempio n. 28
0
            public ROTestCollectionGroup()
                : base(1, 0)
            {
                this.BigFile = this.ImmutableDisk.WriteProjectFile($"Big.proj", TestCollectionGroup.BigProjectFile);
                var projReal = this.Remote[0].LoadProjectWithSettings(this.BigFile, ProjectLoadSettings.IgnoreMissingImports | ProjectLoadSettings.RecordDuplicateButNotCircularImports);

                this.Local.Importing = true;
                Assert.NotNull(projReal);
                this.Real = projReal;
                Assert.NotNull(this.Real);
                var projView = this.Local.GetLoadedProjects(this.BigFile).FirstOrDefault();

                Assert.NotNull(projView);
                this.View = projView;

                ViewValidation.VerifyNotLinkedNotNull(this.Real);
                ViewValidation.VerifyLinkedNotNull(this.View);
            }
Esempio n. 29
0
        public void ProjectExtensionsElementReadOnly()
        {
            var preReal = this.StdGroup.RealXml;
            var preView = this.StdGroup.ViewXml;

            var realExtensionsList = preReal.ChildrenReversed.OfType <ProjectExtensionsElement>().ToList();
            var viewExtensionsList = preView.ChildrenReversed.OfType <ProjectExtensionsElement>().ToList();

            Assert.NotEmpty(realExtensionsList);

            ViewValidation.Verify(viewExtensionsList, realExtensionsList, ViewValidation.Verify);

            var realXml = realExtensionsList.FirstOrDefault();
            var viewXml = viewExtensionsList.FirstOrDefault();

            Assert.Equal(realXml["a"], viewXml["a"]);
            Assert.Equal(realXml["b"], viewXml["b"]);
            Assert.Equal("x", viewXml["a"]);
            Assert.Equal("y", viewXml["b"]);
        }
Esempio n. 30
0
        public static void Verify(ProjectImportElement viewXml, ProjectImportElement realXml, ValidationContext context = null)
        {
            if (viewXml == null && realXml == null)
            {
                return;
            }
            VerifyProjectElement(viewXml, realXml, context);


            Assert.Equal(realXml.Project, viewXml.Project);
            ViewValidation.VerifySameLocation(realXml.ProjectLocation, viewXml.ProjectLocation, context);

            // mostly test the remoting infrastructure. Sdk Imports are not really covered by simple samples for now.
            // Todo: add mock SDK import closure to SdtGroup?
            Assert.Equal(realXml.Sdk, viewXml.Sdk);
            Assert.Equal(realXml.Version, viewXml.Version);
            Assert.Equal(realXml.MinimumVersion, viewXml.MinimumVersion);
            ViewValidation.VerifySameLocation(realXml.SdkLocation, viewXml.SdkLocation, context);
            Assert.Equal(realXml.ImplicitImportLocation, viewXml.ImplicitImportLocation);
            ViewValidation.VerifyProjectElement(viewXml.OriginalElement, realXml.OriginalElement, context);
        }