Beispiel #1
0
        public void DataSetRow_Merge_ValueChanged_OriginalsNotChanged()
        {
            DataSetRow originalRow = new DataSetRow
            {
                ["UserId"]   = 123,
                ["DomainId"] = 1001
            };

            DataSetRow newRow = new DataSetRow
            {
                ["DomainId"] = 2001
            };

            DataSetRow result = originalRow.Merge(newRow);

            Assert.AreEqual(2, originalRow.Count);
            Assert.AreEqual(123, originalRow["UserId"]);
            Assert.AreEqual(1001, originalRow["DomainId"]);

            Assert.AreEqual(1, newRow.Count);
            Assert.AreEqual(2001, newRow["DomainId"]);

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(123, result["UserId"]);
            Assert.AreEqual(2001, result["DomainId"]);
        }
Beispiel #2
0
        public void DataSetRow_Merge_WithNoOriginalWithNewKey_ReturnOriginalAndNew()
        {
            DataSetRow row = new DataSetRow();

            DataSetRow result = row.Merge(new DataSetRow
            {
                ["AddressId"] = 2001
            });

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(2001, result["AddressId"]);
        }
Beispiel #3
0
        public void DataSetRow_Merge_WithEmpty_ReturnOriginal()
        {
            DataSetRow row = new DataSetRow
            {
                ["UserId"]   = 123,
                ["DomainId"] = 1001
            };

            DataSetRow result = row.Merge(new DataSetRow());

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(123, result["UserId"]);
            Assert.AreEqual(1001, result["DomainId"]);
        }
Beispiel #4
0
        public void DataSetRow_Merge_WithExistingKeyNullValue_ReturnNew()
        {
            DataSetRow row = new DataSetRow
            {
                ["UserId"]   = 123,
                ["DomainId"] = 1001
            };

            DataSetRow result = row.Merge(new DataSetRow
            {
                ["DomainId"] = null
            });

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(123, result["UserId"]);
            Assert.AreEqual(null, result["DomainId"]);
        }
Beispiel #5
0
        public void DataSetRow_Merge_WithExistingKeyDifferentType_ReturnNew()
        {
            DataSetRow row = new DataSetRow
            {
                ["UserId"]   = 123,
                ["DomainId"] = 1001
            };

            DataSetRow result = row.Merge(new DataSetRow
            {
                ["DomainId"] = DateTime.Parse("01-Mar-2020")
            });

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(123, result["UserId"]);
            Assert.AreEqual(DateTime.Parse("01-Mar-2020"), result["DomainId"]);
        }
Beispiel #6
0
        public void DataSetRow_Merge_WithNewKey_ReturnOriginalAndNew()
        {
            DataSetRow row = new DataSetRow
            {
                ["UserId"]   = 123,
                ["DomainId"] = 1001
            };

            DataSetRow result = row.Merge(new DataSetRow
            {
                ["AddressId"] = 2001
            });

            Assert.AreEqual(3, result.Count);
            Assert.AreEqual(123, result["UserId"]);
            Assert.AreEqual(1001, result["DomainId"]);
            Assert.AreEqual(2001, result["AddressId"]);
        }