public void List_DefaultIfEmpty() { var list = ReadOnlyList.DefaultIfEmpty(new int[0], 999); Assert.AreEqual(1, list.Count); Assert.AreEqual(999, list[0]); list = ReadOnlyList.DefaultIfEmpty(new int[] { 9, 3, 1 }, 999); Assert.AreEqual(3, list.Count); Assert.AreEqual(9, list[0]); Assert.AreEqual(3, list[1]); Assert.AreEqual(1, list[2]); var list2 = ReadOnlyList.DefaultIfEmpty(new string[0], "999"); Assert.AreEqual(1, list2.Count); Assert.AreEqual("999", list2[0]); list2 = ReadOnlyList.DefaultIfEmpty(new string[] { "three", "two", "one" }, "999"); Assert.AreEqual(3, list2.Count); Assert.AreEqual("three", list2[0]); Assert.AreEqual("two", list2[1]); Assert.AreEqual("one", list2[2]); }