Exemple #1
0
        public void GetSettings_RetrieveSettings_SettingShouldbeReturned()
        {
            //Arrange
            var configurationSection = new Mock <IConfigurationSection>();

            configurationSection.Setup(x => x.Value).Returns("card-wise-journey-store");
            var configuration = new Mock <IConfiguration>();

            configuration.Setup(x => x.GetSection($"{"default"}:{"storage_path"}"))
            .Returns(configurationSection.Object);

            //Act
            var configurationProvider = new Configuration.ConfigurationProvider(configuration.Object);
            var settings = configurationProvider.GetSetting("default", "storage_path");

            //Assert
            Assert.NotNull(settings);
            Assert.True(settings == "card-wise-journey-store");
        }
Exemple #2
0
        public void GetSettings_RetrieveSettings_SettingObjectShouldbeReturned()
        {
            //Arrange
            var capsSectionMock = new Mock <IConfigurationSection>();

            capsSectionMock.Setup(s => s.Value)
            .Returns("[{\"boardingZone\": \"1\",\"destinationZone\": \"1\",\"daily\": 100,\"weekly\": 500},{\"boardingZone\": \"1\",\"destinationZone\": \"1\",\"daily\": 100,\"weekly\": 500}]");
            capsSectionMock.Setup(x => x.Key).Returns("caps");

            var configuration = new Mock <IConfiguration>();

            configuration.Setup(x => x.GetSection($"{"default"}:{"caps"}"))
            .Returns(capsSectionMock.Object);

            //Act
            var configurationProvider  = new Configuration.ConfigurationProvider(configuration.Object);
            List <CapLimits> capLimits = configurationProvider.GetSettingAsObject <List <CapLimits> >("default", "caps");

            //Assert
            Assert.NotNull(capLimits);
            Assert.True(capLimits[0].BoardingZone == "1");
        }
Exemple #3
0
 public ConfigurationProviderTests()
 {
     _provider = new Configuration.ConfigurationProvider();
 }