summaryrefslogtreecommitdiff
path: root/spec/unit/utility/SettingsSpecs.cs
blob: ab4c4f56224d23d2f18186f7c87d6b0ed4e18de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections.Specialized;
using gorilla.utility;
using Machine.Specifications;

namespace specs.unit.utility
{
    public class SettingsSpecs
    {
        public abstract class concern
        {
            Establish context = () =>
            {
                settings = new NameValueCollection();
                sut = new Settings(settings);
            };

            static protected Settings sut;
            static protected NameValueCollection settings;
        }

        public class when_pulling_out_a_setting : concern
        {
            It should_return_the_correct_value = () => result.should_be_true();

            Establish context = () => { settings["the.key"] = "true"; };

            Because of = () => { result = sut.named<bool>("the.key"); };

            static bool result;
        }
    }
}