public void LoadPortalSettings_Loads_Default_Value(Dictionary<string, string> testFields)
        {
            //Arrange
            var propertyName = testFields["PropertyName"];
            var settingName = testFields["SettingName"];
            var isHostDefault = Boolean.Parse(testFields["IsHostDefault"]);
            var defaultValue = testFields["DefaultValue"];
            var controller = new PortalSettingsController();
            var settings = new PortalSettings() { PortalId = ValidPortalId};
            var hostSettings = PortalSettingsControllerTestFactory.GetHostSettings();

            var mockPortalController = new Mock<IPortalController>();
            mockPortalController
                .Setup(c => c.GetPortalSettings(It.IsAny<int>()))
                .Returns(new Dictionary<string, string>());
            PortalController.SetTestableInstance(mockPortalController.Object);

            var mockHostController = new Mock<IHostController>();
            mockHostController.Setup(c => c.GetString(It.IsAny<string>()))
                            .Returns((string s) => hostSettings[s]);
            mockHostController.Setup(c => c.GetString(It.IsAny<string>(), It.IsAny<string>()))
                            .Returns((string s1, string s2) => hostSettings[s1]);
            mockHostController.Setup(c => c.GetBoolean(It.IsAny<string>(), It.IsAny<bool>()))
                            .Returns((string s, bool b) => Boolean.Parse(hostSettings[s]));
            mockHostController.Setup(c => c.GetInteger(It.IsAny<string>(), It.IsAny<int>()))
                            .Returns((string s, int i) => Int32.Parse(hostSettings[s]));
            HostController.RegisterInstance(mockHostController.Object);

            if (isHostDefault)
            {
                defaultValue = hostSettings[settingName];
            }

            //Act
            controller.LoadPortalSettings(settings);


            //Assert
            var property = settings.GetType().GetProperty(propertyName);
            var actualValue = property.GetValue(settings, null);
            if (actualValue is bool)
            {
                Assert.AreEqual(defaultValue, actualValue.ToString().ToLower());
            }
            else
            {
                Assert.AreEqual(defaultValue, actualValue.ToString());
            }
        }
 private static string GetCultureOfSettings(PortalSettings portalSettings)
 {
     //note! should be replaced with compiled call to portalSettings.CultureCode property when base supported version is increased.
     string cultureCode = "";
     PropertyInfo cultureCodePi = portalSettings.GetType().GetProperty("CultureCode");
     if (cultureCodePi != null)
     {
         cultureCode = (string)cultureCodePi.GetValue(portalSettings, null);
     }
     return cultureCode;
 }