private void GetSettings_GetsValuesFrom_ModuleSettingsCollection(string stringValue, int integerValue, double doubleValue, bool booleanValue, DateTime datetimeValue, TimeSpan timeSpanValue, TestingEnum enumValue, ComplexType complexValue) { // Arrange var moduleInfo = GetModuleInfo; var tabModuleSettings = new Hashtable { { SettingNamePrefix + "StringProperty", stringValue }, { SettingNamePrefix + "IntegerProperty", integerValue.ToString() }, { SettingNamePrefix + "DoubleProperty", doubleValue.ToString(CultureInfo.InvariantCulture) }, { SettingNamePrefix + "BooleanProperty", booleanValue.ToString() }, { SettingNamePrefix + "DateTimeProperty", datetimeValue.ToString("o", CultureInfo.InvariantCulture) }, { SettingNamePrefix + "TimeSpanProperty", timeSpanValue.ToString("c", CultureInfo.InvariantCulture) }, { SettingNamePrefix + "EnumProperty", enumValue.ToString() }, { SettingNamePrefix + "ComplexProperty", $"{complexValue.X} | {complexValue.Y}" }, }; this.MockTabModuleSettings(moduleInfo, tabModuleSettings); var settingsRepository = new MyTabModuleSettingsRepository(); // Act var settings = settingsRepository.GetSettings(moduleInfo); // Assert Assert.AreEqual(stringValue, settings.StringProperty, "The retrieved string property value is not equal to the stored one"); Assert.AreEqual(integerValue, settings.IntegerProperty, "The retrieved integer property value is not equal to the stored one"); Assert.AreEqual(doubleValue, settings.DoubleProperty, "The retrieved double property value is not equal to the stored one"); Assert.AreEqual(booleanValue, settings.BooleanProperty, "The retrieved boolean property value is not equal to the stored one"); Assert.AreEqual(datetimeValue, settings.DateTimeProperty, "The retrieved datetime property value is not equal to the stored one"); Assert.AreEqual(timeSpanValue, settings.TimeSpanProperty, "The retrieved timespan property value is not equal to the stored one"); Assert.AreEqual(enumValue, settings.EnumProperty, "The retrieved enum property value is not equal to the stored one"); Assert.AreEqual(complexValue, settings.ComplexProperty, "The retrieved complex property value is not equal to the stored one"); this.MockRepository.VerifyAll(); }
public void GetSettings_CallsGetCachedObject() { //Arrange var moduleInfo = GetModuleInfo; MockCache.Setup(c => c.GetItem("DNN_" + CacheKey(moduleInfo))).Returns(new MyTabModuleSettings()); var settingsRepository = new MyTabModuleSettingsRepository(); //Act settingsRepository.GetSettings(moduleInfo); //Assert MockRepository.VerifyAll(); }