public void TupleDifferentScalars() { var aliases = new[] { "_intProp", "_stringProp" }; var t = new PositionalToBeanResultTransformer(typeof(ASimplePOCO), aliases); Assert.Throws <HibernateException>(() => t.TransformTuple(new object[] { 1 }, aliases)); }
public void Setters() { string[] aliases = new string[] { "_intProp", "_stringProp" }; string[] propAliases = new string[] { "IntProp", "StringProp" }; // Test with field PositionalToBeanResultTransformer t = new PositionalToBeanResultTransformer(typeof(ASimplePOCO), aliases); ASimplePOCO asp = (ASimplePOCO)t.TransformTuple(new object[] { 1, "test" }, aliases); Assert.AreEqual(1, asp.IntProp); Assert.AreEqual("test", asp.StringProp); // Test with properties t = new PositionalToBeanResultTransformer(typeof(ASimplePOCO), propAliases); asp = (ASimplePOCO)t.TransformTuple(new object[] { 1, "test" }, propAliases); Assert.AreEqual(1, asp.IntProp); Assert.AreEqual("test", asp.StringProp); }
public void TupleDifferentScalars() { string[] aliases = new string[] { "_intProp", "_stringProp" }; PositionalToBeanResultTransformer t = new PositionalToBeanResultTransformer(typeof(ASimplePOCO), aliases); ASimplePOCO asp = (ASimplePOCO)t.TransformTuple(new object[] { 1 }, aliases); }
public void ConstructorInvalidType() { PositionalToBeanResultTransformer t = new PositionalToBeanResultTransformer(null, new string[] { "a", "b" }); }
public void ConstructorInvalidAliases() { PositionalToBeanResultTransformer t = new PositionalToBeanResultTransformer(typeof(ASimplePOCO), new string[] {}); }