Example #1
0
        public void startTimerTest()
        {
            using (SPEmulators.SPEmulationContext ctx = new SPEmulators.SPEmulationContext(SPEmulators.IsolationLevel.Fake))
            {
                int opencon  = 0;
                int closecon = 0;
                ShimSqlConnection.AllInstances.Open = (instance) =>
                {
                    opencon++;
                };
                ShimSqlConnection.AllInstances.Close = (instance) =>
                {
                    closecon++;
                };

                ShimProcessorBase.GetWebApplications = () =>
                {
                    SPWebApplicationCollection webapp = new SPWebApplicationCollection(new SPWebService());
                    webapp.Add(new ShimSPWebApplication());
                    webapp.Add(new ShimSPWebApplication());
                    return(webapp);
                };

                TimerRunner tr = new TimerRunner();
                tr.startTimer();
                Thread.Sleep(60000);
                tr.stopTimer();
                Thread.Sleep(3000);
            }
        }