Exemplo n.º 1
0
        public IEnumerable <ITestContainer> GetTestContainers(IVsProject project)
        {
            if (!project.IsTestProject(Guids.NodejsBaseProjectFactory))
            {
                if (EqtTrace.IsVerboseEnabled)
                {
                    EqtTrace.Verbose("TestContainerDiscoverer: Ignoring project {0} as it is not a Node.js project.", project.GetProjectName());
                }

                yield break;
            }

            string path;

            project.GetMkDocument(VSConstants.VSITEMID_ROOT, out path);

            if (_detectingChanges)
            {
                SaveModifiedFiles(project);
            }

            ProjectInfo projectInfo;

            if (!_knownProjects.TryGetValue(path, out projectInfo))
            {
                // Don't return any containers for projects we don't know about.
                yield break;
            }
            projectInfo.HasRequestedContainers = true;

            var latestWrite = project.GetProjectItemPaths().Aggregate(
                _lastWrite,
                (latest, filePath) =>
            {
                try
                {
                    var ft = File.GetLastWriteTimeUtc(filePath);
                    return((ft > latest) ? ft : latest);
                }
                catch (UnauthorizedAccessException)
                {
                }
                catch (ArgumentException)
                {
                }
                catch (IOException)
                {
                }
                return(latest);
            });

            var architecture = Architecture.X86;

            // TODO: Read the architecture from the project

            yield return(new TestContainer(this, path, latestWrite, architecture));
        }
Exemplo n.º 2
0
        public IEnumerable<ITestContainer> GetTestContainers(IVsProject project) {
            if (!project.IsTestProject(GuidList.guidPythonProjectGuid)) {
                if (EqtTrace.IsVerboseEnabled) {
                    EqtTrace.Verbose("TestContainerDiscoverer: Ignoring project {0} as it is not a test project.", project.GetProjectName());
                }

                yield break;
            }

            string path;
            project.GetMkDocument(VSConstants.VSITEMID_ROOT, out path);

            if (_detectingChanges) {
                SaveModifiedFiles(project);
            }

            ProjectInfo projectInfo;
            if (!_knownProjects.TryGetValue(path, out projectInfo)) {
                // Don't return any containers for projects we don't know about.
                yield break;
            }
            projectInfo.HasRequestedContainers = true;
            
            var latestWrite = project.GetProjectItemPaths().Aggregate(
                _lastWrite,
                (latest, filePath) => {
                    try {
                        var ft = File.GetLastWriteTimeUtc(filePath);
                        return (ft > latest) ? ft : latest;
                    } catch (UnauthorizedAccessException) {
                    } catch (ArgumentException) {
                    } catch (IOException) {
                    }
                    return latest;
                });
            
            var architecture = Architecture.X86;
            // TODO: Read the architecture from the project

            yield return new TestContainer(this, path, latestWrite, architecture);
        }