示例#1
0
 private void RunTestNull(TypeModel model, string caption)
 {
     NullableSequences l = new NullableSequences();
     l.Int32List = new List<int?>(new int?[] { 2, null, 3 });
     l.StringList = new List<string> { "a", null, "b", "" };
     l.Int32Array = new int?[] { 4, null, 5, null };
     l.StringArray = new string[] { "c", null, "", "d", null };
     NullableSequences clone = (NullableSequences)model.DeepClone(l);
     Assert.AreEqual("2,,3", string.Join(",", clone.Int32List), caption);
     Assert.IsTrue(clone.StringList.SequenceEqual(new[] { "a", null, "b", "" }));
     Assert.AreEqual("4,,5,", string.Join(",", clone.Int32Array), caption);
     Assert.IsTrue(clone.StringArray.SequenceEqual(new[] { "c", null, "", "d", null }));
 }
示例#2
0
        private void RunTestNonNull(TypeModel model, string caption)
        {
            NullableSequences l = new NullableSequences();

            l.Int32List  = new List <int?>(new int?[] { 2, 3 });
            l.StringList = new List <string> {
                "a", "b", ""
            };
            l.Int32Array  = new int?[] { 4, 5 };
            l.StringArray = new string[] { "c", "", "d" };
            NullableSequences clone = (NullableSequences)model.DeepClone(l);

            Assert.AreEqual("2,3", string.Join(",", clone.Int32List), caption);
            Assert.IsTrue(clone.StringList.SequenceEqual(new[] { "a", "b", "" }));
            Assert.AreEqual("4,5", string.Join(",", clone.Int32Array), caption);
            Assert.IsTrue(clone.StringArray.SequenceEqual(new[] { "c", "", "d" }));
        }