Exemplo n.º 1
0
        public void ConvertToDoubleSerializeTest()
        {
            Expression <Func <SecurityDbContext, int, bool> > criteria = (db, obj) => obj / 2.0 < 5.2;
            CriteriaSerializer criteriaSerializer = new CriteriaSerializer();
            XElement           serialized         = criteriaSerializer.SerializeAsXElement(criteria);
            XElement           nominal            = SerializeTestHelper.CreateBaseCriteriaXElementWithIntObj();

            XElement left = SerializeTestHelper.GetBinaryExpression("Divide",
                                                                    SerializeTestHelper.GetConstantExpression("System.Double", "2"),
                                                                    SerializeTestHelper.GetParameterConvertUnaryExpression("System.Double", "System.Int32", "obj"),
                                                                    "System.Double");
            XElement right = SerializeTestHelper.GetConstantExpression("System.Double", "5.2");
            XElement body  = SerializeTestHelper.GetBinaryExpression("LessThan", right, left);

            SerializeTestHelper.SetLambdaBody(nominal, body);
            SerializeTestHelper.CheckIfNominalAndSerializedAreEqual(nominal, serialized);
        }