コード例 #1
0
        public TestAsset CopyTestAsset(
            string testProjectName,
            [CallerMemberName] string callingMethod = "",
            string identifier            = "",
            string testAssetSubdirectory = "")
        {
            var testProjectDirectory = GetAndValidateTestProjectDirectory(testProjectName, testAssetSubdirectory);

            var testDestinationDirectory =
                GetTestDestinationDirectoryPath(testProjectName, callingMethod, identifier);

            TestDestinationDirectories.Add(testDestinationDirectory);

            var testAsset = new TestAsset(testProjectDirectory, testDestinationDirectory, TestContext.Current.SdkVersion, Log);

            return(testAsset);
        }
コード例 #2
0
        public TestAsset CopyTestAsset(
            string testProjectName,
            [CallerMemberName] string callingMethod = "",
            [CallerFilePath] string callerFilePath  = null,
            string identifier            = "",
            string testAssetSubdirectory = "")
        {
            var testProjectDirectory = GetAndValidateTestProjectDirectory(testProjectName, testAssetSubdirectory);

            var fileName = Path.GetFileNameWithoutExtension(callerFilePath);
            var testDestinationDirectory =
                GetTestDestinationDirectoryPath(testProjectName, callingMethod + "_" + fileName, identifier);

            TestDestinationDirectories.Add(testDestinationDirectory);

            var testAsset = new TestAsset(testProjectDirectory, testDestinationDirectory, TestContext.Current.SdkVersion, Log);

            return(testAsset);
        }
コード例 #3
0
        public TestAsset CreateTestProject(
            TestProject testProject,
            [CallerMemberName] string callingMethod = "",
            string identifier      = "",
            string targetExtension = ".csproj")
        {
            var testDestinationDirectory =
                GetTestDestinationDirectoryPath(testProject.Name, callingMethod, identifier);

            TestDestinationDirectories.Add(testDestinationDirectory);

            var testAsset = new TestAsset(testDestinationDirectory, TestContext.Current.SdkVersion, Log);

            testAsset.TestProject = testProject;

            Stack <TestProject> projectStack = new Stack <TestProject>();

            projectStack.Push(testProject);

            HashSet <TestProject> createdProjects = new HashSet <TestProject>();

            while (projectStack.Count > 0)
            {
                var project = projectStack.Pop();
                if (!createdProjects.Contains(project))
                {
                    project.Create(testAsset, TestAssetsRoot, targetExtension);
                    createdProjects.Add(project);

                    foreach (var referencedProject in project.ReferencedProjects)
                    {
                        projectStack.Push(referencedProject);
                    }
                }
            }

            return(testAsset);
        }