示例#1
0
        public WorkspaceProjectStateChangeDetectorTest()
        {
            EmptySolution = Workspace.CurrentSolution.GetIsolatedSolution();

            var projectId1 = ProjectId.CreateNewId("One");
            var projectId2 = ProjectId.CreateNewId("Two");
            var projectId3 = ProjectId.CreateNewId("Three");

            CshtmlDocumentId = DocumentId.CreateNewId(projectId1);
            var cshtmlDocumentInfo = DocumentInfo.Create(CshtmlDocumentId, "Test", filePath: "file.cshtml.g.cs");

            RazorDocumentId = DocumentId.CreateNewId(projectId1);
            var razorDocumentInfo = DocumentInfo.Create(RazorDocumentId, "Test", filePath: "file.razor.g.cs");

            BackgroundVirtualCSharpDocumentId = DocumentId.CreateNewId(projectId1);
            var backgroundDocumentInfo = DocumentInfo.Create(BackgroundVirtualCSharpDocumentId, "Test", filePath: "file.razor__bg__virtual.cs");

            PartialComponentClassDocumentId = DocumentId.CreateNewId(projectId1);
            var partialComponentClassDocumentInfo = DocumentInfo.Create(PartialComponentClassDocumentId, "Test", filePath: "file.razor.cs");

            SolutionWithTwoProjects = Workspace.CurrentSolution
                                      .AddProject(ProjectInfo.Create(
                                                      projectId1,
                                                      VersionStamp.Default,
                                                      "One",
                                                      "One",
                                                      LanguageNames.CSharp,
                                                      filePath: "One.csproj",
                                                      documents: new[] { cshtmlDocumentInfo, razorDocumentInfo, partialComponentClassDocumentInfo, backgroundDocumentInfo }))
                                      .AddProject(ProjectInfo.Create(
                                                      projectId2,
                                                      VersionStamp.Default,
                                                      "Two",
                                                      "Two",
                                                      LanguageNames.CSharp,
                                                      filePath: "Two.csproj"));

            SolutionWithOneProject = EmptySolution.GetIsolatedSolution()
                                     .AddProject(ProjectInfo.Create(
                                                     projectId3,
                                                     VersionStamp.Default,
                                                     "Three",
                                                     "Three",
                                                     LanguageNames.CSharp,
                                                     filePath: "Three.csproj"));

            ProjectNumberOne   = SolutionWithTwoProjects.GetProject(projectId1);
            ProjectNumberTwo   = SolutionWithTwoProjects.GetProject(projectId2);
            ProjectNumberThree = SolutionWithOneProject.GetProject(projectId3);

            HostProjectOne   = new HostProject("One.csproj", FallbackRazorConfiguration.MVC_1_1, "One");
            HostProjectTwo   = new HostProject("Two.csproj", FallbackRazorConfiguration.MVC_1_1, "Two");
            HostProjectThree = new HostProject("Three.csproj", FallbackRazorConfiguration.MVC_1_1, "Three");
        }
示例#2
0
        public WorkspaceProjectSnapshotChangeTriggerTest()
        {
            Workspace     = new AdhocWorkspace();
            EmptySolution = Workspace.CurrentSolution.GetIsolatedSolution();

            ProjectNumberOne        = Workspace.CurrentSolution.AddProject("One", "One", LanguageNames.CSharp);
            ProjectNumberTwo        = ProjectNumberOne.Solution.AddProject("Two", "Two", LanguageNames.CSharp);
            SolutionWithTwoProjects = ProjectNumberTwo.Solution;

            ProjectNumberThree     = EmptySolution.GetIsolatedSolution().AddProject("Three", "Three", LanguageNames.CSharp);
            SolutionWithOneProject = ProjectNumberThree.Solution;
        }
示例#3
0
        public WorkspaceProjectSnapshotChangeTriggerTest()
        {
            Workspace     = TestWorkspace.Create();
            EmptySolution = Workspace.CurrentSolution.GetIsolatedSolution();

            var projectId1 = ProjectId.CreateNewId("One");
            var projectId2 = ProjectId.CreateNewId("Two");
            var projectId3 = ProjectId.CreateNewId("Three");

            SolutionWithTwoProjects = Workspace.CurrentSolution
                                      .AddProject(ProjectInfo.Create(
                                                      projectId1,
                                                      VersionStamp.Default,
                                                      "One",
                                                      "One",
                                                      LanguageNames.CSharp,
                                                      filePath: "One.csproj"))
                                      .AddProject(ProjectInfo.Create(
                                                      projectId2,
                                                      VersionStamp.Default,
                                                      "Two",
                                                      "Two",
                                                      LanguageNames.CSharp,
                                                      filePath: "Two.csproj"));

            SolutionWithOneProject = EmptySolution.GetIsolatedSolution()
                                     .AddProject(ProjectInfo.Create(
                                                     projectId3,
                                                     VersionStamp.Default,
                                                     "Three",
                                                     "Three",
                                                     LanguageNames.CSharp,
                                                     filePath: "Three.csproj"));

            ProjectNumberOne   = SolutionWithTwoProjects.GetProject(projectId1);
            ProjectNumberTwo   = SolutionWithTwoProjects.GetProject(projectId2);
            ProjectNumberThree = SolutionWithOneProject.GetProject(projectId3);

            HostProjectOne   = new HostProject("One.csproj", FallbackRazorConfiguration.MVC_1_1);
            HostProjectTwo   = new HostProject("Two.csproj", FallbackRazorConfiguration.MVC_1_1);
            HostProjectThree = new HostProject("Three.csproj", FallbackRazorConfiguration.MVC_1_1);
        }
示例#4
0
        public WorkspaceProjectStateChangeDetectorTest()
        {
            EmptySolution = Workspace.CurrentSolution;

            var projectId1 = ProjectId.CreateNewId("One");
            var projectId2 = ProjectId.CreateNewId("Two");
            var projectId3 = ProjectId.CreateNewId("Three");

            CshtmlDocumentId = DocumentId.CreateNewId(projectId1);
            var cshtmlDocumentInfo = DocumentInfo.Create(CshtmlDocumentId, "Test", filePath: "file.cshtml.g.cs");

            RazorDocumentId = DocumentId.CreateNewId(projectId1);
            var razorDocumentInfo = DocumentInfo.Create(RazorDocumentId, "Test", filePath: "file.razor.g.cs");

            BackgroundVirtualCSharpDocumentId = DocumentId.CreateNewId(projectId1);
            var backgroundDocumentInfo = DocumentInfo.Create(BackgroundVirtualCSharpDocumentId, "Test", filePath: "file.razor__bg__virtual.cs");

            PartialComponentClassDocumentId = DocumentId.CreateNewId(projectId1);
            var partialComponentClassDocumentInfo = DocumentInfo.Create(PartialComponentClassDocumentId, "Test", filePath: "file.razor.cs");

            SolutionWithTwoProjects = Workspace.CurrentSolution
                                      .AddProject(ProjectInfo.Create(
                                                      projectId1,
                                                      VersionStamp.Default,
                                                      "One",
                                                      "One",
                                                      LanguageNames.CSharp,
                                                      filePath: "One.csproj",
                                                      documents: new[] { cshtmlDocumentInfo, razorDocumentInfo, partialComponentClassDocumentInfo, backgroundDocumentInfo }))
                                      .AddProject(ProjectInfo.Create(
                                                      projectId2,
                                                      VersionStamp.Default,
                                                      "Two",
                                                      "Two",
                                                      LanguageNames.CSharp,
                                                      filePath: "Two.csproj"));

            SolutionWithOneProject = EmptySolution
                                     .AddProject(ProjectInfo.Create(
                                                     projectId3,
                                                     VersionStamp.Default,
                                                     "Three",
                                                     "Three",
                                                     LanguageNames.CSharp,
                                                     filePath: "Three.csproj"));

            var project2Reference = new ProjectReference(projectId2);
            var project3Reference = new ProjectReference(projectId3);

            SolutionWithDependentProject = Workspace.CurrentSolution
                                           .AddProject(ProjectInfo.Create(
                                                           projectId1,
                                                           VersionStamp.Default,
                                                           "One",
                                                           "One",
                                                           LanguageNames.CSharp,
                                                           filePath: "One.csproj",
                                                           documents: new[] { cshtmlDocumentInfo, razorDocumentInfo, partialComponentClassDocumentInfo, backgroundDocumentInfo },
                                                           projectReferences: new[] { project2Reference }))
                                           .AddProject(ProjectInfo.Create(
                                                           projectId2,
                                                           VersionStamp.Default,
                                                           "Two",
                                                           "Two",
                                                           LanguageNames.CSharp,
                                                           filePath: "Two.csproj",
                                                           projectReferences: new[] { project3Reference }))
                                           .AddProject(ProjectInfo.Create(
                                                           projectId3,
                                                           VersionStamp.Default,
                                                           "Three",
                                                           "Three",
                                                           LanguageNames.CSharp,
                                                           filePath: "Three.csproj",
                                                           documents: new[] { razorDocumentInfo }));

            ProjectNumberOne   = SolutionWithTwoProjects.GetProject(projectId1);
            ProjectNumberTwo   = SolutionWithTwoProjects.GetProject(projectId2);
            ProjectNumberThree = SolutionWithOneProject.GetProject(projectId3);

            HostProjectOne        = new HostProject("One.csproj", FallbackRazorConfiguration.MVC_1_1, "One");
            HostProjectTwo        = new HostProject("Two.csproj", FallbackRazorConfiguration.MVC_1_1, "Two");
            HostProjectThree      = new HostProject("Three.csproj", FallbackRazorConfiguration.MVC_1_1, "Three");
            WorkQueue             = new BatchingWorkQueue(TimeSpan.FromMilliseconds(1), StringComparer.Ordinal, new DefaultErrorReporter());
            WorkQueueTestAccessor = WorkQueue.GetTestAccessor();
            WorkQueue.GetTestAccessor().NotifyBackgroundWorkCompleted = null;
            WorkQueueTestAccessor.NotifyBackgroundWorkCompleted = new ManualResetEventSlim(initialState: false);
        }