protected override TestSolutionConfiguration CreateSolutionConfiguration(
            ICollection <KeyValuePair <TargetFrameworkId, IEnumerable <string> > > referencedLibraries,
            IEnumerable <string> fileSet)
        {
            if (fileSet == null)
            {
                throw new ArgumentNullException(nameof(fileSet));
            }

            var mainProjectFileSet  = fileSet.Where(filename => !filename.Contains("_SecondProject"));
            var mainAbsoluteFileSet = mainProjectFileSet.Select(path => TestDataPath2.Combine(path)).ToList();

            var descriptors =
                new Dictionary <IProjectDescriptor, IList <Pair <IProjectReferenceDescriptor, IProjectReferenceProperties> > >();

            var mainDescriptorPair = CreateProjectDescriptor(ProjectName, ProjectName, mainAbsoluteFileSet,
                                                             referencedLibraries, ProjectGuid);

            descriptors.Add(mainDescriptorPair.First, mainDescriptorPair.Second);

            var referencedProjectFileSet = fileSet.Where(filename => filename.Contains("_SecondProject")).ToList();

            if (referencedProjectFileSet.Any())
            {
                var secondAbsoluteFileSet =
                    referencedProjectFileSet.Select(path => TestDataPath2.Combine(path)).ToList();
                var secondProjectName    = "Second_" + ProjectName;
                var secondDescriptorPair = CreateProjectDescriptor(secondProjectName, secondProjectName,
                                                                   secondAbsoluteFileSet, referencedLibraries, SecondProjectGuid);
                descriptors.Add(secondDescriptorPair.First, secondDescriptorPair.Second);
            }

            return(new TestSolutionConfiguration(SolutionFileName, descriptors));
        }
        private void CleanupReferences()
        {
            foreach (var assembly in GetReferencedAssemblies(GetPlatformID()))
            {
                var assemblyPath = FileSystemPath.Parse(assembly);
                var destination  = TestDataPath2.CombineWithShortName(assemblyPath.Name);

                if (assemblyPath.IsAbsolute && assemblyPath.ExistsFile && destination.ExistsFile)
                {
                    destination.DeleteFile();
                }
            }
        }
        private void EnsureReferences()
        {
            // Copy the xunit dlls to the current dir
            foreach (var assembly in GetReferencedAssemblies(GetPlatformID()))
            {
                var assemblyPath = FileSystemPath.Parse(assembly);
                var destination  = TestDataPath2.CombineWithShortName(assemblyPath.Name);

                if (assemblyPath.IsAbsolute && assemblyPath.ExistsFile && !destination.ExistsFile)
                {
                    assemblyPath.CopyFile(destination, true);
                }
            }
        }
        protected override void PrepareBeforeRun(IProject testProject)
        {
            foreach (var assembly in GetReferencedAssemblies(GetPlatformID()))
            {
                var location  = FileSystemPath.Parse(assembly);
                var reference = ProjectToAssemblyReference.CreateFromLocation(testProject, location);
                ((ProjectImpl)testProject).DoAddReference(reference);

                if (location.IsAbsolute && location.ExistsFile)
                {
                    var localCopy = TestDataPath2.Combine(location.Name);
                    if (!localCopy.ExistsFile || localCopy.FileModificationTimeUtc < location.FileModificationTimeUtc)
                    {
                        location.CopyFile(localCopy, true);
                    }
                }
            }
        }
 // ReSharper disable once MemberCanBePrivate.Global
 public IEnumerable <string> GetAllSourceFilesInTestDirectory()
 {
     InferProductHomeDir();
     return(TestDataPath2.GetChildFiles("*.cs").Select(p => p.Name));
 }
示例#6
0
 // ReSharper disable once MemberCanBePrivate.Global
 public IEnumerable <string> GetAllCSharpFilesInDirectory()
 {
     InferProductHomeDir();
     return(TestDataPath2.GetChildFiles("*.cs").Select(path => path.Name));
 }