Exemplo n.º 1
0
        public void ExecuteSingle_Empty_ShouldThrowException()
        {
            var fakeResult = new DataContextTestClass.Customer[0];

            var retrieverMock = GetRetrieverMockStrict(fakeResult);

            var executor = CreateQueryExecutor(retrieverMock);

            executor.ExecuteSingle <DataContextTestClass.Customer> (_queryModel, false);
        }
Exemplo n.º 2
0
        public void ExecuteSingle_Empty_ShouldGetDefault()
        {
            var fakeResult = new DataContextTestClass.Customer[0];

            var retrieverMock = GetRetrieverMockStrict(fakeResult);

            var executor = CreateQueryExecutor(retrieverMock);
            var result   = executor.ExecuteSingle <DataContextTestClass.Customer> (_queryModel, true);

            retrieverMock.VerifyAllExpectations();
            Assert.That(result, Is.EqualTo(default(DataContextTestClass.Customer)));
        }
        public void ResolveConstantExpression()
        {
            var customer = new DataContextTestClass.Customer {
                CustomerID = "abc"
            };
            var constantExpr = Expression.Constant(customer);

            var result = _mappingResolver.ResolveConstantExpression(constantExpr);

            var expectedExpr = new SqlEntityConstantExpression(typeof(DataContextTestClass.Customer), customer, Expression.Constant(customer.CustomerID, typeof(string)));

            SqlExpressionTreeComparer.CheckAreEqualTrees(expectedExpr, result);
        }