Exemplo n.º 1
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(
                XTestCaseNames.TestCase
                , XTestResultNames.TestResult
                ));
 }
Exemplo n.º 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
        }
Exemplo n.º 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
        }
Exemplo n.º 4
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(
                XNames.TestClass
                , XNames.Placeholder
                , XConcurrencyNames.Error
                ));
 }
Exemplo n.º 5
0
 protected override IEnumerable <XElement> GetChildElements()
 {
     return(DataElement.Elements()
            .Where(el =>
                   el.Name == XSessionNames.Pluginengine ||
                   el.Name == XSessionNames.Run
                   ));
 }
Exemplo n.º 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();
 }
Exemplo n.º 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
                ));
 }
Exemplo n.º 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))
            );
 }
Exemplo n.º 9
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement
            .Elements(
                XNames.ExpectedTestResult
                , XNames.ExpectedRegressionTestResult
                , XNames.ExpectedChessResult
                , XNames.TaskoMeter
                ));
 }
Exemplo n.º 10
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(
                XNames.CustomBuild,
                XNames.MSBuild,
                XNames.Testlist,
                XNames.TestProject,
                XNames.TestAssembly,
                XNames.Include,
                XNames.Placeholder
                ));
 }
Exemplo n.º 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
                               )));
        }
Exemplo n.º 12
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(ChildEntityXNames));
 }
Exemplo n.º 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);
        }
Exemplo n.º 14
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(XConcurrencyNames.Error));
 }
Exemplo n.º 15
0
 public IEnumerable <string> GetShellLines()
 {
     return(DataElement
            .Elements(XNames.Shellline)
            .SelectXValues());
 }
Exemplo n.º 16
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     // Need to also allow the ContextXName elements too
     return(DataElement
            .Elements(ContextXName, XSessionNames.MCutTestRun));
 }
Exemplo n.º 17
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement
            .Elements(XSessionNames.MCutTestRun));
 }
Exemplo n.º 18
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement.Elements(XNames.ChessContext, XNames.TestMethod));
 }
Exemplo n.º 19
0
 protected override IEnumerable <XElement> GetChildEntityElements()
 {
     return(DataElement
            .Elements(XNames.ChessContext, XNames.ExpectedChessResult)
            .Union(base.GetChildEntityElements()));
 }
Exemplo n.º 20
0
 public IEnumerable <string> GetCommandLineArgs()
 {
     return(DataElement
            .Elements(XNames.Arg)
            .SelectXValues());
 }
Exemplo n.º 21
0
 protected override IEnumerable <XElement> DescendantXRuns()
 {
     return(DataElement
            .Elements(TestEntityXNames)
            .Descendants(XSessionNames.MCutTestRun));
 }
Exemplo n.º 22
0
 protected override IEnumerable <XElement> DescendantXRuns()
 {
     return(DataElement.Elements(XTestResultNames.TestResult)
            .Descendants(XSessionNames.MCutTestRun));
 }