public void GetValueOrDefault() { Assert.AreEqual(new CloneableType("five"), _array.GetValueOrDefault(4)); Assert.AreEqual(new CloneableType("two"), _array.GetValueOrDefault(0, 1)); Assert.AreEqual(new CloneableType("four"), _array.GetValueOrDefault(1, 0)); Assert.AreEqual(null, _array.GetValueOrDefault(-1)); Assert.AreEqual(null, _array.GetValueOrDefault(6)); Assert.AreEqual(null, _array.GetValueOrDefault(3, 0)); StringArray array = new StringArray(2, 3, 4); array.SetValue(new CloneableType("foo"), 1, 2, 3); Assert.AreEqual(new CloneableType("foo"), array.GetValueOrDefault(1, 2, 3)); Assert.AreEqual(null, array.GetValueOrDefault(1, 3, 3)); }