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" }); }
public void GetString() { var d = new DObject(); Should.Throw <KeyNotFoundException>(() => d.GetString("key")); d.Set("key", "value"); d.GetString("key").ShouldBe("value"); }
public void GetValue() { var d = new DObject(); Should.Throw <KeyNotFoundException>(() => d.GetValue <int>("key")); d.Set("key", 1); d.GetValue <int>("key").ShouldBe(1); }
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" }); }
public void GetValues() { var d = new DObject(); Should.Throw <KeyNotFoundException>(() => d.GetValues <int>("key")); d.Set("key", 1); Should.Throw <InvalidCastException>(() => d.GetValues <int>("key")); d.Set("key", new[] { 1 }); var values = d.GetValues <int>("key"); values.ShouldBe(new[] { 1 }); values.Add(2); d.GetValues <int>("key").ShouldBe(new[] { 1, 2 }); }