public void DeepClone_IfBinary_CopiesValue()
        {
            // Arrange
            byte original = 0x12;

            byte[] expected = new byte[] { original, 0x34 };
            // Act
            EntityProperty property = TableEntityValueBinder.DeepClone(new EntityProperty(expected));

            // Assert
            expected[0] = 0xFF;
            Assert.NotNull(property);
            Assert.AreEqual(EdmType.Binary, property.PropertyType); // Guard
            byte[] actual = property.BinaryValue;
            Assert.NotNull(actual);                                 // Guard
            Assert.True(actual.Length == 2);                        // Guard
            Assert.AreEqual(original, actual[0]);
        }
示例#2
0
 public IDictionary <string, EntityProperty> CloneProperties()
 {
     // Clone properties when retrieving, so changes to the retrieved value in memory don't affect the
     // persisted data.
     return(TableEntityValueBinder.DeepClone(_properties));
 }