示例#1
0
        public static ActionResult WixRunImmediateUnitTests(Session session)
        {
            LuxUnitTestFactory factory  = new LuxUnitTestFactory();
            LuxLogger          logger   = new LuxLogger(session);
            string             sql      = String.Concat("SELECT `WixUnitTest`, `CustomAction_`, `Property`, `Operator`, `Value`, `Expression`, `Condition`, `ValueSeparator`, `NameValueSeparator`, `Index` FROM ", Constants.LuxTableName, " WHERE `Mutation` IS NULL");
            string             mutation = session[Constants.LuxMutationRunningProperty];

            if (!String.IsNullOrEmpty(mutation))
            {
                sql = String.Concat(sql, " OR `Mutation` = '", mutation, "'");
            }

            using (View view = session.Database.OpenView(sql))
            {
                view.Execute();

                foreach (Record rec in view)
                {
                    using (rec)
                    {
                        LuxUnitTest unitTest = factory.CreateUnitTest(session, rec, logger);
                        if (null != unitTest)
                        {
                            if (unitTest.IsTestConditionMet())
                            {
                                unitTest.RunTest();
                            }
                            unitTest.LogResult();
                        }
                    }
                }
            }

            return(ActionResult.UserExit);
        }
示例#2
0
        public static ActionResult WixRunImmediateUnitTests(Session session)
        {
            LuxUnitTestFactory factory = new LuxUnitTestFactory();
            LuxLogger logger = new LuxLogger(session);
            string sql = String.Concat("SELECT `WixUnitTest`, `CustomAction_`, `Property`, `Operator`, `Value`, `Expression`, `Condition`, `ValueSeparator`, `NameValueSeparator`, `Index` FROM ", Constants.LuxTableName, " WHERE `Mutation` IS NULL");
            string mutation = session[Constants.LuxMutationRunningProperty];
            if (!String.IsNullOrEmpty(mutation))
            {
                sql = String.Concat(sql, " OR `Mutation` = '", mutation, "'");
            }

            using (View view = session.Database.OpenView(sql))
            {
                view.Execute();

                foreach (Record rec in view)
                {
                    using (rec)
                    {
                        LuxUnitTest unitTest = factory.CreateUnitTest(session, rec, logger);
                        if (null != unitTest)
                        {
                            if (unitTest.IsTestConditionMet())
                            {
                                unitTest.RunTest();
                            }
                            unitTest.LogResult();
                        }
                    }
                }
            }

            return ActionResult.UserExit;    
        }