예제 #1
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(
                XTestCaseNames.TestCase
                , XTestResultNames.TestResult
                ));
 }
예제 #2
0
        protected override void OnChildrenLoaded()
        {
            base.OnChildrenLoaded();

            _expResults = DataElement.Elements(XNames.ExpectedTestResult)
                          .SelectEntities <ExpectedTestResultEntity>()
                          .ToDictionary(e => e.Key); // If duplicate keys exist, an error will be thrown
        }
예제 #3
0
        protected override void OnChildrenLoaded()
        {
            base.OnChildrenLoaded();

            _contexts = DataElement.Elements(ContextXName)
                        .SelectEntities <TContext>()
                        .ToDictionary(ctx => ctx.Name); // If duplicate keys exist, an error will be thrown
        }
예제 #4
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(
                XNames.TestClass
                , XNames.Placeholder
                , XConcurrencyNames.Error
                ));
 }
예제 #5
0
 protected override IEnumerable <XElement> GetChildElements()
 {
     return(DataElement.Elements()
            .Where(el =>
                   el.Name == XSessionNames.Pluginengine ||
                   el.Name == XSessionNames.Run
                   ));
 }
예제 #6
0
 public MSBuildProject(XElement xel)
     : base(xel)
 {
     // Since each instance is mutable, we create the objects for the configurations right now.
     _configurations = DataElement
                       .Elements(XSessionMSBuildNames.ProjectConfiguration)
                       .Select(x => new MSBuildProjectConfiguration(x))
                       .ToArray();
 }
예제 #7
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     // NOTE: We purposely don't include the SessionState element
     return(DataElement.Elements(
                XNames.Testlist
                , XNames.TestProject
                , XNames.TestAssembly
                ));
 }
예제 #8
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     // NOTE: I'm making sure these get returned in the order in the schema
     // since I'm doing a custom union with nested elements
     return(DataElement.Elements(XConcurrencyNames.Error)
            .Union(DataElement.Elements(XChessNames.ChessResults).Elements(XChessNames.Result))
            .Union(DataElement.Elements(TestRunEntity.TestRunXNames))
            );
 }
예제 #9
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement
            .Elements(
                XNames.ExpectedTestResult
                , XNames.ExpectedRegressionTestResult
                , XNames.ExpectedChessResult
                , XNames.TaskoMeter
                ));
 }
예제 #10
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(
                XNames.CustomBuild,
                XNames.MSBuild,
                XNames.Testlist,
                XNames.TestProject,
                XNames.TestAssembly,
                XNames.Include,
                XNames.Placeholder
                ));
 }
예제 #11
0
        protected override IEnumerable <XElement> GetChildEntityElements()
        {
            // Start with the build runs
            IEnumerable <XElement> children;

            if (_msbuildProj == null)
            {
                children = Enumerable.Empty <XElement>();
            }
            else
            {
                children = _msbuildProj.DataElement.Elements(XSessionNames.BuildRun);
            }

            return(children
                   .Concat(DataElement
                           .Elements(
                               XNames.TestAssembly
                               , XNames.Include          // For loading the test assembly once we know what it's full location is from the project file
                               , XNames.Placeholder
                               , XConcurrencyNames.Error // Failure to load the project file
                               )));
        }
예제 #12
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(ChildEntityXNames));
 }
예제 #13
0
        public bool TryLoadProjectFile()
        {
            // Remove our previous error
            // It's not in the try-catch because any error is due to other code, not due to a loading failure.
            if (ProjectLoadError != null)
            {
                ProjectLoadError.DataElement.Remove();
            }

            XElement xmsbProj = null;
            XElement xerror   = null;

            try
            {
                xmsbProj = MSBuildProject.ParseProjectFileToXElement(SourceFilePath);
                if (xmsbProj == null)
                {
                    xerror = XNames.CreateXError("Project file could not be found.");
                }

                // Replace existing element or add it
                // Note: The element isn't an entity
                if (_msbuildProj != null)
                {
                    // We replace so the order of the child elements are preserved (i.e. if a TestAssembly el also exists)
                    Debug.Assert(_msbuildProj.DataElement.Parent == this.DataElement);

                    // move the previous runs to the new project element
                    var prevRuns = _msbuildProj.DataElement.Elements(XSessionNames.BuildRun).ToArray();
                    foreach (var prevRun in prevRuns)
                    {
                        prevRun.Remove();
                        xmsbProj.Add(prevRun);
                    }

                    //
                    _msbuildProj.DataElement.ReplaceWith(xmsbProj);
                }
                else
                {
                    DataElement.Add(xmsbProj);
                }

                // create the new one
                _msbuildProj = new MSBuildProject(xmsbProj);
            }
            catch (Exception ex)
            {
                xerror = XNames.CreateXError("An error occurred trying to parse the project file.", ex);
            }

            if (xerror != null)
            {
                // Clear out the existing extra elements if they exist
                var elementsToRemove = DataElement.Elements(XSessionMSBuildNames.Project, XNames.TestAssembly, XNames.Include);
                foreach (var xel in elementsToRemove)
                {
                    xel.Remove();
                }

                // Add the error and then eject
                this.AddEntity <ErrorEntity>(xerror);
                return(false);
            }

            // Make sure we use the correct configuration name
            if (Configuration != null && !_msbuildProj.Configurations.Any(cfg => cfg.Configuration == Configuration))
            {
                Configuration = null; // Reset to use the default configuration
            }
            else  // Call the changed event manually so we get a new ProjectConfiguration obj that's part of the new MSBuildProject instance
            {
                OnConfigurationChanged();
            }

            return(true);
        }
예제 #14
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(XConcurrencyNames.Error));
 }
예제 #15
0
 public IEnumerable <string> GetShellLines()
 {
     return(DataElement
            .Elements(XNames.Shellline)
            .SelectXValues());
 }
예제 #16
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     // Need to also allow the ContextXName elements too
     return(DataElement
            .Elements(ContextXName, XSessionNames.MCutTestRun));
 }
예제 #17
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement
            .Elements(XSessionNames.MCutTestRun));
 }
예제 #18
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(XNames.ChessContext, XNames.TestMethod));
 }
예제 #19
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement
            .Elements(XNames.ChessContext, XNames.ExpectedChessResult)
            .Union(base.GetChildEntityElements()));
 }
예제 #20
0
 public IEnumerable <string> GetCommandLineArgs()
 {
     return(DataElement
            .Elements(XNames.Arg)
            .SelectXValues());
 }
예제 #21
0
 protected override IEnumerable <XElement> DescendantXRuns()
 {
     return(DataElement
            .Elements(TestEntityXNames)
            .Descendants(XSessionNames.MCutTestRun));
 }
예제 #22
0
 protected override IEnumerable <XElement> DescendantXRuns()
 {
     return(DataElement.Elements(XTestResultNames.TestResult)
            .Descendants(XSessionNames.MCutTestRun));
 }