Ejemplo n.º 1
0
        public void TestNodeProperties()
        {
            UIThreadInvoker.Invoke((ThreadInvoker) delegate()
            {
                //Get the global service provider and the dte
                IServiceProvider sp = VsIdeTestHostContext.ServiceProvider;
                DTE dte             = (DTE)sp.GetService(typeof(DTE));

                string destination  = Path.Combine(TestContext.TestDir, TestContext.TestName);
                ProjectNode project = Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true);

                string newFileName       = TestUtils.GetNewFileName(project.ProjectFolder, "test", "cs");
                ProjectElement item      = project.CreateMsBuildFileItem(newFileName, "Content");
                FileNode node            = project.CreateFileNode(item);
                FileNodeProperties props = node.NodeProperties as FileNodeProperties;
                Assert.IsNotNull(props);

                // Test the build action.
                Assert.IsTrue(props.BuildAction == BuildAction.Content, "The BuildAction build action should be set to compile model");
                props.BuildAction = BuildAction.Compile;
                Assert.IsTrue(props.BuildAction == BuildAction.Compile, "BuildAction has not been set correctly in the project file");
                props.BuildAction = BuildAction.EmbeddedResource;
                Assert.IsTrue(props.BuildAction == BuildAction.EmbeddedResource, "BuildAction has not been set correctly in the project file");
                props.BuildAction = BuildAction.None;
                Assert.IsTrue(props.BuildAction == BuildAction.None, "BuildAction has not been set correctly in the project file");
            });
        }
Ejemplo n.º 2
0
        public void TestCreatingFileNode()
        {
            UIThreadInvoker.Invoke((ThreadInvoker) delegate()
            {
                //Get the global service provider and the dte
                IServiceProvider sp = VsIdeTestHostContext.ServiceProvider;
                DTE dte             = (DTE)sp.GetService(typeof(DTE));

                string destination  = Path.Combine(TestContext.TestDir, TestContext.TestName);
                ProjectNode project = Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true);

                string newFileName  = TestUtils.GetNewFileName(project.ProjectFolder, "test", "cs");
                ProjectElement item = project.CreateMsBuildFileItem(newFileName, "Compile");
                FileNode node       = project.CreateFileNode(item);
                Assert.IsNotNull(node);
            });
        }