public void Test_Binding_NullToValueType_Throws() { RootModel model = new RootModel(); Relation rel = DatabaseHelper.Default.Relation(model, "Complex.Value"); IField value = rel.Scalar(); Should.Throw <BindingException>(() => value.Bind(null)); }
public void Test_Binding_OfNonConvertibleValue_Throws() { RootModel model = new RootModel(); Relation rel = DatabaseHelper.Default.Relation(model, "Complex.Value"); IField value = rel.Scalar(); Should.Throw <BindingException>(() => value.Bind("String")); }
public void Test_Binding_WithContravariance() { RootModel model = new RootModel(); Relation rel = DatabaseHelper.Default.Relation(model, "Object"); IField value = rel.Scalar(); Should.NotThrow(() => value.Bind(new RootModel())); }
public void Test_Binding_ToMissing_Throws() { Model model = new Model(); Relation rel = DatabaseHelper.Default.Relation(model, "Complex.Value"); IField value = rel.Scalar(); Should.Throw <BindingException>(() => value.Bind(10)); }
public void Test_Binding_ToNullValue() { RootModel model = new RootModel(); Relation rel = DatabaseHelper.Default.Relation(model, "Complex"); IField complex = rel.Scalar(); complex.ShouldNotBeNull(); Should.NotThrow(() => complex.Bind(new RootModel.SubModel() { Value = 10 })); model.Complex.Value.ShouldBe(10); }
public void Test_Binding_ToProperty() { RootModel model = new RootModel() { Complex = new RootModel.SubModel() }; Relation rel = DatabaseHelper.Default.Relation(model, "Complex.Value"); IField value = rel.Scalar(); value.Bind(12); value.ShouldNotBeNull(); value.Value.ShouldBe(12); model.Complex.Value.ShouldBe(12); }