public void Settings_Should_Load_From_Repository_When_Cache_Is_Not_Set() { // Arrange CacheMock cache = new CacheMock(); ApplicationSettings appSettings = new ApplicationSettings(); Mock <IPluginCache> pluginCacheMock = new Mock <IPluginCache>(); PluginSettings expectedPluginSettings = new PluginSettings("mockplugin", "1.0"); expectedPluginSettings.SetValue("repository", "test"); RepositoryMock repository = new RepositoryMock(); repository.PluginSettings = expectedPluginSettings; TextPluginStub plugin = new TextPluginStub(); plugin.PluginCache = pluginCacheMock.Object; plugin.Repository = repository; // Act PluginSettings actualPluginSettings = plugin.Settings; // Assert Assert.That(actualPluginSettings, Is.Not.Null); Assert.That(actualPluginSettings.GetValue("repository"), Is.EqualTo("test")); }
public void GetValue_Should_Be_Case_Insensitive() { // Arrange PluginSettings settings = new PluginSettings("mockplugin", "1.0"); // Act settings.SetValue("name", "value"); string value = settings.GetValue("NaME"); // Assert Assert.That(value, Is.EqualTo("value")); }
public void getvalue_should_be_case_insensitive() { // Arrange PluginSettings settings = new PluginSettings("mockplugin", "1.0"); // Act settings.SetValue("name", "value"); string value = settings.GetValue("NaME"); // Assert Assert.That(value, Is.EqualTo("value")); }
public void GetValue_Should_Return_Known_Value() { // Arrange PluginSettings settings = new PluginSettings("mockplugin", "1.0"); // Act settings.SetValue("name1", "value1"); settings.SetValue("name2", "value2"); string value = settings.GetValue("name1"); // Assert Assert.That(value, Is.EqualTo("value1")); }
public void getvalue_should_return_known_value() { // Arrange PluginSettings settings = new PluginSettings("mockplugin", "1.0"); // Act settings.SetValue("name1", "value1"); settings.SetValue("name2", "value2"); string value = settings.GetValue("name1"); // Assert Assert.That(value, Is.EqualTo("value1")); }
public void settings_should_load_from_cache_when_settings_exist_in_cache() { // Arrange Mock <IPluginCache> pluginCacheMock = new Mock <IPluginCache>(); PluginSettings expectedPluginSettings = new PluginSettings("mockplugin", "1.0"); expectedPluginSettings.SetValue("cache", "test"); TextPluginStub plugin = new TextPluginStub(); plugin.PluginCache = pluginCacheMock.Object; pluginCacheMock.Setup(x => x.GetPluginSettings(plugin)).Returns(expectedPluginSettings); // Act PluginSettings actualPluginSettings = plugin.Settings; // Assert Assert.That(actualPluginSettings, Is.Not.Null); Assert.That(actualPluginSettings.GetValue("cache"), Is.EqualTo("test")); }
public void Settings_Should_Load_From_Cache_When_Settings_Exist_In_Cache() { // Arrange CacheMock cache = new CacheMock(); ApplicationSettings appSettings = new ApplicationSettings(); Mock <IPluginCache> pluginCacheMock = new Mock <IPluginCache>(); PluginSettings expectedPluginSettings = new PluginSettings("mockplugin", "1.0"); expectedPluginSettings.SetValue("cache", "test"); TextPluginStub plugin = new TextPluginStub(); plugin.PluginCache = pluginCacheMock.Object; pluginCacheMock.Setup(x => x.GetPluginSettings(plugin)).Returns(expectedPluginSettings); // Act PluginSettings actualPluginSettings = plugin.Settings; // Assert Assert.That(actualPluginSettings, Is.Not.Null); Assert.That(actualPluginSettings.GetValue("cache"), Is.EqualTo("test")); }
public void settings_should_load_from_repository_when_cache_is_not_set() { // Arrange Mock <IPluginCache> pluginCacheMock = new Mock <IPluginCache>(); PluginSettings expectedPluginSettings = new PluginSettings("mockplugin", "1.0"); expectedPluginSettings.SetValue("repository", "test"); var settingsRepositoryMock = new SettingsRepositoryMock(); settingsRepositoryMock.PluginSettings = expectedPluginSettings; TextPluginStub plugin = new TextPluginStub(); plugin.PluginCache = pluginCacheMock.Object; plugin.Repository = settingsRepositoryMock; // Act PluginSettings actualPluginSettings = plugin.Settings; // Assert Assert.That(actualPluginSettings, Is.Not.Null); Assert.That(actualPluginSettings.GetValue("repository"), Is.EqualTo("test")); }