private void SaveSettings_CallsUpdateModuleSetting_WithRightParameters(string stringValue, int integerValue, double doubleValue, bool booleanValue, DateTime datetimeValue, TimeSpan timeSpanValue, TestingEnum enumValue, ComplexType complexValue) { //Arrange var moduleInfo = GetModuleInfo; var settings = new ModulesSettings { StringProperty = stringValue, IntegerProperty = integerValue, DoubleProperty = doubleValue, BooleanProperty = booleanValue, DateTimeProperty = datetimeValue, TimeSpanProperty = timeSpanValue, EnumProperty = enumValue, ComplexProperty = complexValue, }; MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "StringProperty", stringValue)); MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "IntegerProperty", integerValue.ToString())); MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "DoubleProperty", doubleValue.ToString(CultureInfo.InvariantCulture))); MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "BooleanProperty", booleanValue.ToString())); MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "DateTimeProperty", datetimeValue.ToString("o", CultureInfo.InvariantCulture))); MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "TimeSpanProperty", timeSpanValue.ToString("c", CultureInfo.InvariantCulture))); MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "EnumProperty", enumValue.ToString())); MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, SettingNamePrefix + "ComplexProperty", $"{complexValue.X} | {complexValue.Y}")); var settingsRepository = new ModulesSettingsRepository(); //Act settingsRepository.SaveSettings(moduleInfo, settings); //Assert MockRepository.VerifyAll(); }
private void SaveSettings_CallsUpdateSetting_WithRightParameters(string stringValue, int?integerValue, DateTime?datetimeValue, TimeSpan?timeSpanValue) { //Arrange var moduleInfo = GetModuleInfo; var settings = new MyNullableSettings { StringProperty = stringValue, IntegerProperty = integerValue, DateTimeProperty = datetimeValue, TimeSpanProperty = timeSpanValue, }; var expectedStringValue = stringValue ?? string.Empty; MockModuleController.Setup(pc => pc.UpdateModuleSetting(ModuleId, "StringProperty", expectedStringValue)); var integerString = integerValue?.ToString() ?? string.Empty; MockPortalController.Setup(pc => pc.UpdatePortalSetting(PortalId, "IntegerProperty", integerString, true, Null.NullString)); var dateTimeString = datetimeValue?.ToString("o", CultureInfo.InvariantCulture) ?? string.Empty; MockModuleController.Setup(mc => mc.UpdateModuleSetting(ModuleId, "DateTimeProperty", dateTimeString)); var timeSpanString = timeSpanValue?.ToString("c", CultureInfo.InvariantCulture) ?? string.Empty; MockModuleController.Setup(mc => mc.UpdateTabModuleSetting(TabModuleId, "TimeSpanProperty", timeSpanString)); var settingsRepository = new MyNullableSettingsRepository(); //Act settingsRepository.SaveSettings(moduleInfo, settings); //Assert MockRepository.VerifyAll(); }
public void SetUp() { m_moduleController = new MockModuleController(); }
public void SetUp() { m_mockery = new Mockery(); m_moduleController = new MockModuleController(); m_moduleCoordinator = m_mockery.NewMock <IModuleCoordinator>(); }
public void SetUp() { m_mockery = new Mockery(); m_moduleController = new MockModuleController(); m_moduleCoordinator = m_mockery.NewMock<IModuleCoordinator>(); }