Пример #1
0
        public void MergeTestWithValues()
        {
            var context = TestExecuter.GetContext();

            context.SetRowType <DictionaryRow>();

            var row = new TrackedRow(context.CreateRow(null));

            row["a"] = 1;
            row["b"] = "dog";
            row["c"] = 7.1d;

            var newValues = new Dictionary <string, object>()
            {
                ["b"] = "cat",
                ["c"] = null,
                ["d"] = 8m,
            };

            row.MergeWith(newValues);

            Assert.AreEqual(3, row.ColumnCount);
            Assert.AreEqual(1, row["a"]);
            Assert.AreEqual("cat", row["b"]);
            Assert.IsFalse(row.HasValue("c"));
            Assert.AreEqual(8m, row["d"]);
        }
Пример #2
0
        public void MergeTestWithRow()
        {
            var context = TestExecuter.GetContext();

            context.SetRowType <DictionaryRow>();

            var row = new TrackedRow(context.CreateRow(null));

            row["a"] = 1;
            row["b"] = "dog";
            row["c"] = 7.1d;

            var newRow = new SlimRow()
            {
                ["b"] = "cat",
                ["c"] = 7.1d,
                ["d"] = 8m,
            };

            row.MergeWith(newRow.Values);

            Assert.AreEqual(4, row.ColumnCount);
            Assert.AreEqual(1, row["a"]);
            Assert.AreEqual("cat", row["b"]);
            Assert.AreEqual(7.1d, row["c"]);
            Assert.AreEqual(8m, row["d"]);
        }