public void Test_GenericBinding_UnspecifiedValueSelector() { Assert.ThrowsException <InvalidOperationException>(() => { GenericDataPointBinding <int, int> binding = new GenericDataPointBinding <int, int>(); binding.GetValue(0); }); }
public void Test_GenericBinding_UnexpectedInstance() { Assert.ThrowsException <ArgumentNullException>(() => { GenericDataPointBinding <BusinessObject, double> binding = new GenericDataPointBinding <BusinessObject, double>(); binding.ValueSelector = (o) => o.Value.Value; binding.GetValue(null); }); }
public void Test_GenericBinding() { GenericDataPointBinding <BusinessObject, double> binding = new GenericDataPointBinding <BusinessObject, double>(); binding.ValueSelector = (o) => o.Value.Value; BusinessObject obj = new BusinessObject() { Value = 1 }; Assert.AreEqual <double>(1, (double)binding.GetValue(obj), "Value not looked-up correctly"); }