static void TestSetCurrentValue(ResXFileType resXFileType, bool allowNoCodeGeneration, CodeDomProvider codeProvider, string initialCustomTool, string initialNamespace, string newCurrentValue, string expectedCustomTool, string expectedNamespace) { ResourceEditorRootDesigner designer = new ResourceEditorRootDesigner(); ProjectItemFake projectItem; projectItem = new ProjectItemWithCustomToolFake(initialCustomTool, initialNamespace); IServiceProvider sp = AccessModifierComboboxTests.CreateServiceProviderWithIVSMDCodeDomProvider(codeProvider); ResourceEditorView.ResourceEditorAccessModifierCombobox combo = new ResourceEditorView.ResourceEditorAccessModifierCombobox( resXFileType == ResXFileType.DefaultResX, allowNoCodeGeneration, designer, sp, projectItem, codeProvider is VBCodeProvider ? "My.Resources" : null ); Microsoft_VisualStudio_Editors_DesignerFramework_AccessModifierComboboxAccessor accessor = new Microsoft_VisualStudio_Editors_DesignerFramework_AccessModifierComboboxAccessor(combo); // Call the method under test accessor.SetCurrentValue(newCurrentValue); // Verify results Assert.AreEqual(expectedCustomTool, projectItem.Fake_PropertiesCollection.Item("CustomTool").Value); Assert.AreEqual(expectedNamespace, projectItem.Fake_PropertiesCollection.Item("CustomToolNamespace").Value); }
static void TestSetCurrentValue(CodeDomProvider codeProvider, string initialCustomTool, string initialNamespace, string newCurrentValue, string expectedCustomTool, string expectedNamespace) { SD.SettingsDesigner designer = new SD.SettingsDesigner(); ProjectItemFake projectItem; projectItem = new ProjectItemWithCustomToolFake(initialCustomTool, initialNamespace); 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); // Call the method under test accessor.SetCurrentValue(newCurrentValue); // Verify results Assert.AreEqual(expectedCustomTool, projectItem.Fake_PropertiesCollection.Item("CustomTool").Value); Assert.AreEqual(expectedNamespace, projectItem.Fake_PropertiesCollection.Item("CustomToolNamespace").Value); }