public void DeleteFile() { ProjectItemFake projectItemFake = ProjectItem; if (projectItemFake != null) { m_hierarchyFake.Fake_projectItems.Remove(projectItemFake.ItemId); } m_itemid = 0xFFFFFFFF; }
public void CreateFile() { ProjectItemFake projectItemFake = this.ProjectItem; if (projectItemFake != null) { return; } projectItemFake = new ProjectItemWithBuildActionFake(m_pathToCreate, m_pathToCreate, "None"); projectItemFake.Fake_PropertiesCollection.Fake_PropertiesDictionary["ItemType"].Value = m_initialBuildAction; m_hierarchyFake.Fake_AddProjectItem(projectItemFake); m_itemid = projectItemFake.ItemId; }
// // You can use the following additional attributes as you write your tests: // // Use ClassInitialize to run code before running the first test in the class // [ClassInitialize()] // public static void MyClassInitialize(TestContext testContext) { } // // Use ClassCleanup to run code after all tests in a class have run // [ClassCleanup()] // public static void MyClassCleanup() { } // // Use TestInitialize to run code before running each test // [TestInitialize()] // public void MyTestInitialize() { } // // Use TestCleanup to run code after each test has run // [TestCleanup()] // public void MyTestCleanup() { } // #endregion #region "Utilities" public void TestGetCurrentValue(string expectedCurrentValue, object customToolValue, bool supportCustomToolValueInProject, CodeDomProvider codeProvider) { SD.SettingsDesigner designer = new SD.SettingsDesigner(); ProjectItemFake projectItem; if (supportCustomToolValueInProject) { projectItem = new ProjectItemWithCustomToolFake(customToolValue); } else { projectItem = new ProjectItemFake(); } Mock <IVSMDCodeDomProvider> vsmdCodeDomProviderMock = new Mock <IVSMDCodeDomProvider>(); vsmdCodeDomProviderMock.Implement("get_CodeDomProvider", codeProvider); ServiceProviderMock spMock = new ServiceProviderMock(); if (codeProvider != null) { spMock.Fake_AddService(typeof(IVSMDCodeDomProvider), vsmdCodeDomProviderMock.Instance); } else { spMock.Fake_AddService(typeof(IVSMDCodeDomProvider), null); } SD.SettingsDesignerView.SettingsDesignerAccessModifierCombobox combo = new SD.SettingsDesignerView.SettingsDesignerAccessModifierCombobox( designer, spMock.Instance, projectItem, codeProvider is VBCodeProvider ? "My" : null); Microsoft_VisualStudio_Editors_DesignerFramework_AccessModifierComboboxAccessor accessor = new Microsoft_VisualStudio_Editors_DesignerFramework_AccessModifierComboboxAccessor(combo); Assert.AreEqual(expectedCurrentValue, accessor.GetCurrentValue()); }
static void TestIsEnabled(bool expectedIsEnabled, ResXFileType resXFileType, object initialCustomToolValue, bool supportCustomToolValueInProject, CodeDomProvider codeProvider) { if (resXFileType == ResXFileType.DefaultResX) { Assert.IsTrue(codeProvider == null || codeProvider is VBCodeProvider, "Problem in the unit test itself: don't pass in ResXFileType.DefaultResX except for VB"); } ResourceEditorRootDesigner designer = new ResourceEditorRootDesigner(); ProjectItemFake projectItem; if (supportCustomToolValueInProject) { projectItem = new ProjectItemWithCustomToolFake(initialCustomToolValue); } else { projectItem = new ProjectItemFake(); } IServiceProvider sp = AccessModifierComboboxTests.CreateServiceProviderWithIVSMDCodeDomProvider(codeProvider); ResourceEditorAccessModifierComboboxSubclass combo = new ResourceEditorAccessModifierComboboxSubclass( true, resXFileType == ResXFileType.DefaultResX, !(resXFileType == ResXFileType.DefaultResX), designer, sp, projectItem, codeProvider is VBCodeProvider ? "My.Resources" : null ); Microsoft_VisualStudio_Editors_DesignerFramework_AccessModifierComboboxAccessor accessor = new Microsoft_VisualStudio_Editors_DesignerFramework_AccessModifierComboboxAccessor(combo); Assert.AreEqual(expectedIsEnabled, accessor.ShouldBeEnabled()); }
public void Fake_AddProjectItem(ProjectItemFake projectitem) { Fake_projectItems.Add(projectitem.ItemId, projectitem); }