コード例 #1
0
 public void ThrowsWhenTheValueIsNotInConfigAndRequired()
 {
     IConfig config = new Config();
     IList<string> actualResult = config.GetList("doesnt-exist", isRequired: true);
 }
コード例 #2
0
            public void ReturnsTheGivenList()
            {
                IConfig config = new Config();
                IList<string> actualResult = config.GetList("sampleList");

                IList<string> expectedResult = new List<string> { "one", "two", "three", "four" };

                CustomAssert.AreEqual<string>(expectedResult, actualResult, (x, y) => { Assert.AreEqual(x, y); });
            }
コード例 #3
0
            public void ReturnsTheDefaultValueWhenConfigValueNotFound()
            {
                IConfig config = new Config();
                IList<string> expectedResult = new List<string> { "default", "value", "here" };
                IList<string> actualResult = config.GetList("doesnt-exist", defaultValue: expectedResult);

                Assert.AreEqual(expectedResult, actualResult);
            }
コード例 #4
0
            public void ReturnsTheExpectedResultWhenACustomDelimterIsUsed()
            {
                IConfig config = new Config();
                IList<string> actualResult = config.GetList("sampleList-customDelim",delimiter:'|');

                IList<string> expectedResult = new List<string> { "one", "two", "three", "four" };

                CustomAssert.AreEqual<string>(expectedResult, actualResult, (x, y) => { Assert.AreEqual(x, y); });
            }
コード例 #5
0
            public void ReturnsNullWhenNotInConfigAndNotRequired()
            {
                IConfig config = new Config();
                IList<string> actualResult = config.GetList("doesnt-exist", isRequired: false);

                Assert.IsNull(actualResult);
            }