コード例 #1
0
        public void TupleDifferentScalars()
        {
            var aliases = new[] { "_intProp", "_stringProp" };
            var t       = new PositionalToBeanResultTransformer(typeof(ASimplePOCO), aliases);

            Assert.Throws <HibernateException>(() => t.TransformTuple(new object[] { 1 }, aliases));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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);
 }
コード例 #4
0
 public void ConstructorInvalidType()
 {
     PositionalToBeanResultTransformer t = new PositionalToBeanResultTransformer(null, new string[] { "a", "b" });
 }
コード例 #5
0
 public void ConstructorInvalidAliases()
 {
     PositionalToBeanResultTransformer t =
         new PositionalToBeanResultTransformer(typeof(ASimplePOCO), new string[] {});
 }