public void HaveUserResolveConcurrency(DbPropertyValues currentValues, DbPropertyValues databaseValues, DbPropertyValues resolvedValues) { currentValues.GetValue <Article>("ArticleId"); resolvedValues.SetValues(db.Articles.Find().Name); }
public void SetValues_when_nested_dictionary_is_for_wrong_type_throws() { var fromProperties = new Dictionary<string, object> { { "Id", 1 } }; var fromValues = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(fromProperties)); var toProperties = new Dictionary<string, object> { { "Id", 0 } }; var toValues = new DbPropertyValues(new TestInternalPropertyValues<FakeDerivedTypeWithProps>(toProperties)); Assert.Equal( Strings.DbPropertyValues_AttemptToSetValuesFromWrongType( typeof(FakeTypeWithProps).Name, typeof(FakeDerivedTypeWithProps).Name), Assert.Throws<ArgumentException>(() => toValues.SetValues(fromValues)).Message); }
public void Non_Generic_DbPropertyValues_SetValues_with_a_dictionary_works_on_the_underlying_dictionary() { var fromValues = new DbPropertyValues(CreateSimpleValues()); fromValues["Id"] = 1; var toValues = new DbPropertyValues(CreateSimpleValues()); toValues.SetValues(fromValues); Assert.Equal(1, toValues["Id"]); }
public void Calling_SetValues_with_dictionary_of_derived_type_works() { var fromProperties = new Dictionary<string, object> { { "Id", 1 } }; var fromValues = new DbPropertyValues(new TestInternalPropertyValues<FakeDerivedTypeWithProps>(fromProperties)); var toProperties = new Dictionary<string, object> { { "Id", 0 } }; var toValues = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(toProperties)); toValues.SetValues(fromValues); Assert.Equal(1, toValues["Id"]); }
public void Attempt_to_copy_values_from_null_dictionary_on_non_generic_DbPropertyValues_throws() { var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>()); Assert.Equal("propertyValues", Assert.Throws<ArgumentNullException>(() => values.SetValues(null)).ParamName); }
public void Calling_SetValues_with_instance_of_derived_type_works() { var properties = new Dictionary<string, object> { { "Id", 0 } }; var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(properties)); values.SetValues( new FakeDerivedTypeWithProps { Id = 1 }); Assert.Equal(1, values["Id"]); }
public void Non_Generic_DbPropertyValues_SetValues_works_on_the_underlying_dictionary() { var properties = new Dictionary<string, object> { { "Id", 0 } }; var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(properties)); values.SetValues( new FakeTypeWithProps { Id = 1 }); Assert.Equal(1, values["Id"]); }
public void Attempt_to_copy_values_from_null_object_throws() { var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>()); Assert.Equal("obj", Assert.Throws<ArgumentNullException>(() => values.SetValues((object)null)).ParamName); }
public void SetValues(IDbPropertyValuesBase propertyValues) { _dbPropertyValues.SetValues(propertyValues); }