Exemplo n.º 1
0
        public void ReadConfiguration_Should_Throw_With_Unsupported_Configuration()
        {
            var configurationReader = new AppConfigReader(TestData.UnsupportedConfigurationValues);

            Assert.Throws <InvalidOperationException>(() =>
            {
                configurationReader.ReadConfiguration <UnsupportedConfiguration>();
            });
        }
Exemplo n.º 2
0
        public void ReadConfiguration_Not_Throws_With_Valid_Configuration()
        {
            var configurationReader = new AppConfigReader(TestData.ValidConfigurationValues);
            var configuration       = configurationReader.ReadConfiguration <Configuration>();

            Assert.AreEqual(configuration.Version, 2);
            Assert.AreEqual(configuration.UsersCount, 100000000000000L);
            Assert.AreEqual(configuration.Epsilon, 0.001d);
            Assert.AreEqual(configuration.MinimumTransferAmount, 2.5555555555555M);
            Assert.AreEqual(configuration.Revision, 'A');
            Assert.AreEqual(configuration.CachingType, CachingType.Redis);
            Assert.AreEqual(configuration.SiteName, "localhost");
            Assert.AreEqual(configuration.Api.MainEndpoint, "/calculate");
            Assert.AreEqual(configuration.Api.SessionLength, TimeSpan.FromMinutes(30));
            Assert.AreEqual(configuration.Api.Authentication.Username, "Viktor");
            Assert.AreEqual(configuration.Api.Authentication.PasswordExpires.ToUniversalTime(), new DateTime(2014, 6, 2, 22, 14, 0));
            Assert.AreEqual(configuration.Api.Authentication.ShouldChangePassword, true);
        }
Exemplo n.º 3
0
        public void ReadConfiguration_Not_Throws_With_Valid_Configuration()
        {
            var configurationReader = new AppConfigReader(TestData.ValidConfigurationValues);
            var configuration       = configurationReader.ReadConfiguration <Configuration>();

            Assert.Equal(2, configuration.Version);
            Assert.Equal(100000000000000L, configuration.UsersCount);
            Assert.Equal(0.001d, configuration.Epsilon);
            Assert.Equal(2.5555555555555M, configuration.MinimumTransferAmount);
            Assert.Equal('A', configuration.Revision);
            Assert.Equal(CachingType.Redis, configuration.CachingType);
            Assert.Equal("localhost", configuration.SiteName);
            Assert.Equal("/calculate", configuration.Api.MainEndpoint);
            Assert.Equal(TimeSpan.FromMinutes(30), configuration.Api.SessionLength);
            Assert.Equal("Viktor", configuration.Api.Authentication.Username);
            Assert.Equal(new DateTime(2014, 6, 2, 22, 14, 0), configuration.Api.Authentication.PasswordExpires.ToUniversalTime());
            Assert.True(configuration.Api.Authentication.ShouldChangePassword);
        }