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.AreEqual(prjBuildAction.prjBuildActionContent, props.BuildAction, "The BuildAction build action should be set to compile model"); props.BuildAction = prjBuildAction.prjBuildActionCompile; Assert.AreEqual(prjBuildAction.prjBuildActionCompile, props.BuildAction, "BuildAction has not been set correctly in the project file"); props.BuildAction = prjBuildAction.prjBuildActionEmbeddedResource; Assert.AreEqual(prjBuildAction.prjBuildActionEmbeddedResource, props.BuildAction, "BuildAction has not been set correctly in the project file"); props.BuildAction = prjBuildAction.prjBuildActionNone; Assert.AreEqual(prjBuildAction.prjBuildActionNone, props.BuildAction, "BuildAction has not been set correctly in the project file"); }); }
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); }); }