Example #1
0
        public void MissingKeyTest()
        {
            var sut = new IniConfigWrapper($"{TestContext.CurrentContext.TestDirectory}../../../data/test.ini");
            var ex  = Assert.Throws <System.Exception>(() => sut.Get <double>("nosuchKey"));

            Assert.That(ex.Message, Does.StartWith($"No config value found"));
        }
Example #2
0
        public void ForValidEntryWeGetString(string key, string defaultValue, string expected)
        {
            Console.WriteLine(TestContext.CurrentContext.TestDirectory);
            var sut = new IniConfigWrapper($"{TestContext.CurrentContext.TestDirectory}../../../data/test.ini");

            sut.Get(key, defaultValue).Should().Be(expected);
        }
Example #3
0
        public void GetAllKeys()
        {
            var sut = new IniConfigWrapper($"{TestContext.CurrentContext.TestDirectory}../../../data/test.ini");

            sut.AllKeys().Length.Should().Be(2);
            sut.AllKeys().First().Should().Be("foo");
            sut.AllKeys().Last().Should().Be("Section.value");
        }