コード例 #1
0
            public void Current_value_for_complex_property_cannot_be_set_to_null_even_if_it_is_already_null()
            {
                var properties = new Dictionary <string, object>
                {
                    { "ComplexProp", null }
                };
                var currentValues = new TestInternalPropertyValues <FakeWithProps>(properties, new[] { "ComplexProp" });
                var entityEntry   = FakeWithProps.CreateMockInternalEntityEntry(currentValues).Object;
                var propEntry     = new InternalEntityPropertyEntry(entityEntry, FakeWithProps.ComplexPropertyMetadata);

                Assert.Equal(
                    Strings.DbPropertyValues_ComplexObjectCannotBeNull("ComplexProp", "FakeWithProps"),
                    Assert.Throws <InvalidOperationException>(() => propEntry.CurrentValue = null).Message);
            }
コード例 #2
0
            public void Current_value_returned_for_complex_property_can_be_null()
            {
                var properties = new Dictionary <string, object>
                {
                    { "ComplexProp", null }
                };
                var currentValues = new TestInternalPropertyValues <FakeWithProps>(properties, new[] { "ComplexProp" });
                var entityEntry   = FakeWithProps.CreateMockInternalEntityEntry(currentValues).Object;
                var propEntry     = new InternalEntityPropertyEntry(entityEntry, FakeWithProps.ComplexPropertyMetadata);

                var value = propEntry.CurrentValue;

                Assert.Null(value);
            }