Esempio n. 1
0
        public void ProjectState_RemoveHostDocument_NotFoundNoops()
        {
            // Arrange
            var original = new ProjectState(Workspace.Services, HostProject, WorkspaceProject)
                           .AddHostDocument(Documents[2])
                           .AddHostDocument(Documents[1]);

            // Act
            var state = original.RemoveHostDocument(Documents[0]);

            // Assert
            Assert.Same(original, state);
        }
Esempio n. 2
0
        public void ProjectState_RemoveHostDocument_FromProjectWithDocuments()
        {
            // Arrange
            var original = new ProjectState(Workspace.Services, HostProject, WorkspaceProject)
                           .AddHostDocument(Documents[2])
                           .AddHostDocument(Documents[1]);

            // Act
            var state = original.RemoveHostDocument(Documents[1]);

            // Assert
            Assert.NotEqual(original.Version, state.Version);

            Assert.Collection(
                state.Documents.OrderBy(kvp => kvp.Key),
                d => Assert.Same(Documents[2], d.Value.HostDocument));
        }
Esempio n. 3
0
        public void ProjectState_RemoveHostDocument_RetainsComputedState()
        {
            // Arrange
            var original = new ProjectState(Workspace.Services, HostProject, WorkspaceProject)
                           .AddHostDocument(Documents[2])
                           .AddHostDocument(Documents[1]);

            // Force init
            GC.KeepAlive(original.ProjectEngine);
            GC.KeepAlive(original.TagHelpers);

            // Act
            var state = original.RemoveHostDocument(Documents[2]);

            // Assert
            Assert.Same(original.ProjectEngine, state.ProjectEngine);
            Assert.Same(original.TagHelpers, state.TagHelpers);

            Assert.Same(original.Documents[Documents[1].FilePath], state.Documents[Documents[1].FilePath]);
        }