コード例 #1
0
        public void WhenDefaultClassValueProvidedForMissingKey()
        {
            var @default = new Person { Age = 25 };

            var person = new AppConfig().Value().For("jon", @default);

            Assert.That(person.Age, Is.EqualTo(@default.Age));
        }
コード例 #2
0
        public void WhenMissingKeyWithDefaultValueIsRequestedFromLookup()
        {
            var lookup = new AppConfig();

            lookup.Value().For("age", 23);

            Assert.That(lookup.Value().For<int>("age"), Is.EqualTo(23));
        }
コード例 #3
0
        public void WhenDecimalIsRequestedFromAppConfig()
        {
            var lookup = new AppConfig();

            lookup.Get("howlongisapieceofstring", "9876543210.9876543210");
            lookup.Get("dob", "1995-10-10");

            Assert.That(lookup.Value().For<decimal>("howlongisapieceofstring"), Is.EqualTo(9876543210.9876543210));
        }