public void TestScopeConverterConvertTo_String()
        {
            DesignTimeSettingInstance.ScopeConverter converter = new DesignTimeSettingInstance.ScopeConverter();
            DesignTimeSettingInstance instance = new DesignTimeSettingInstance();

            Assert.AreEqual <string>("Application", (string)converter.ConvertTo(null, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.Application, typeof(string)));
            Assert.AreEqual <string>("User", (string)converter.ConvertTo(null, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.User, typeof(string)));

            Mock <System.ComponentModel.ITypeDescriptorContext> contextMock = new Mock <System.ComponentModel.ITypeDescriptorContext>();

            contextMock.Implement("get_Instance", instance);

            Assert.AreEqual <string>("Application", (string)converter.ConvertTo(contextMock.Instance, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.Application, typeof(string)));
            Assert.AreEqual <string>("User", (string)converter.ConvertTo(contextMock.Instance, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.User, typeof(string)));

            instance.SetProvider(Microsoft.VisualStudio.Editors.PropertyPages.ServicesPropPageAppConfigHelper.ClientSettingsProviderName());
            Assert.AreEqual <string>("Application (Web)", (string)converter.ConvertTo(contextMock.Instance, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.Application, typeof(string)));
            Assert.AreEqual <string>("User (Web)", (string)converter.ConvertTo(contextMock.Instance, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.User, typeof(string)));

            instance.SetProvider("Random provider");
            Assert.AreEqual <string>("Application", (string)converter.ConvertTo(contextMock.Instance, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.Application, typeof(string)));
            Assert.AreEqual <string>("User", (string)converter.ConvertTo(contextMock.Instance, System.Globalization.CultureInfo.CurrentCulture, DesignTimeSettingInstance.SettingScope.User, typeof(string)));
        }
 public void TestScopeConverterCanConvertFrom_StringAndOther()
 {
     DesignTimeSettingInstance.ScopeConverter converter = new DesignTimeSettingInstance.ScopeConverter();
     Assert.IsTrue(converter.CanConvertFrom(null, typeof(string)));
     Assert.IsFalse(converter.CanConvertFrom(null, typeof(System.ComponentModel.TypeDescriptor)));
 }