Esempio n. 1
0
        public void GetStringsConverted()
        {
            var d = new DObject();

            Should.Throw <KeyNotFoundException>(() => d.GetStrings("key"));

            d.Set("key", 1);

            Should.Throw <InvalidCastException>(() => d.GetStrings("key"));

            d.Set("key", new[] { 1 });

            d.GetStrings("key").ShouldBe(new[] { "1" });
        }
Esempio n. 2
0
        public void GetStrings()
        {
            var d = new DObject();

            Should.Throw <KeyNotFoundException>(() => d.GetStrings("key"));

            d.Set("key", "value");

            Should.Throw <InvalidCastException>(() => d.GetStrings("key"));

            d.Set("key", new[] { "value1" });

            var values = d.GetStrings("key");

            values.ShouldBe(new[] { "value1" });

            values.Add("value2");

            d.GetStrings("key").ShouldBe(new[] { "value1", "value2" });
        }