public void Get_WhenCalled_ReturnsConfigItemList() { // Arrange var configItems = new List <IConfigItem>() { new ConfigItem("key1", "value1"), new ConfigItem("key2", "value2"), new ConfigItem("key3", "value3"), }; _memoryCacheService.GetAll().Returns(configItems); _fileManager.ReadAllEntriesFromFile().Returns(configItems); _configurationService = new ConfigurationService(_fileManager, _memoryCacheService); // Act var result = _configurationService.Get(); // Assert Assert.IsNotNull(result); Assert.AreEqual(result.Count, configItems.Count); Assert.AreEqual(configItems[0].value, result.First(x => x.key == configItems[0].key).value); Assert.AreEqual(configItems[1].value, result.First(x => x.key == configItems[1].key).value); Assert.AreEqual(configItems[2].value, result.First(x => x.key == configItems[2].key).value); _memoryCacheService.Received(1).GetAll(); }
/// <summary> /// Get all entries from the configuration. /// </summary> /// <returns>Dictionary of key value pairs.</returns> public List <IConfigItem> Get() { return(_memoryCacheService.GetAll()); }