示例#1
0
        public void CustomQuery_SimpleCall_SessionMethodCalled()
        {
            var query = new TestQuery();

            var sqlQuery = new Mock <ISQLQuery>();

            sqlQuery.Setup(x => x.SetResultTransformer(It.IsAny <IResultTransformer>()))
            .Returns(sqlQuery.Object);
            var session = new Mock <ISession>();

            session.Setup(x => x.CreateSQLQuery(It.IsAny <string>()))
            .Returns(sqlQuery.Object);
            var repository = new EntityRepository <object>(session.Object);

            repository.CustomQuery(query);

            sqlQuery.Verify(x => x.SetParameter(It.IsAny <string>(), It.IsAny <object>()));
            sqlQuery.Verify(x => x.SetResultTransformer(It.IsAny <IResultTransformer>()));
        }