예제 #1
0
        public void CleanProcessedAndDispatched()
        {
            MdnManager target = CreateManager();

            InitMdnRecords();

            //
            // Ensure all test data is procesed or dispatched
            //
            {
                var mdns = target.GetExpiredProcessed(TimeSpan.FromMinutes(0), 100);
                foreach (var mdn in mdns)
                {
                    mdn.Status = MdnStatus.Processed;
                    target.Update(mdn);
                }

                mdns = target.GetExpiredDispatched(TimeSpan.FromMinutes(0), 100);
                foreach (var mdn in mdns)
                {
                    mdn.Status = MdnStatus.Dispatched;
                    target.Update(mdn);
                }
            }
            Assert.Equal(0, target.GetExpiredProcessed(TimeSpan.FromMinutes(0), 100).Count());
            Assert.Equal(0, target.GetExpiredDispatched(TimeSpan.FromMinutes(0), 100).Count());

            System.Threading.Thread.Sleep(1000);
            target.RemoveDispositions(TimeSpan.FromSeconds(.001), 100);
            Assert.Equal(0, target.Count());
        }
예제 #2
0
        public void GetByMdnIdentifierTest()
        {
            MdnManager target = CreateManager();

            InitMdnRecords();
            Assert.Equal(61, target.Count());
            Assert.NotNull(target.Get("9C2458C2370E2C00E2E8701EE3064B6B"));
        }
예제 #3
0
        public void AddTest()
        {
            MdnManager target = CreateManager();

            target.RemoveAll();
            Assert.Equal(0, target.Count());
            string messageId = Guid.NewGuid().ToString();
            var    mdn       = BuildMdn(messageId, "*****@*****.**", "*****@*****.**", "To dispatch or not dispatch", MdnStatus.Started);

            target.Start(new Mdn[] { mdn });
            mdn = target.Get(mdn.MdnIdentifier);
            Assert.Equal(MdnStatus.Started, mdn.Status);
            Assert.Equal("To dispatch or not dispatch", mdn.SubjectValue);
        }
예제 #4
0
        public void TestTimeoutCleanup()
        {
            //
            // Sample data
            //
            MdnManager target = CreateManager();

            InitOldMdnRecords();

            CleanDispositions dispositions = new CleanDispositions();

            Assert.Equal(91, target.Count());

            //No records older than 10 days.
            JobExecutionContext context = CreateCleanTimeoutJobExecutionContext(11);

            dispositions.Execute(context);
            Assert.Equal(91, target.Count());

            //Should clean up 10 dispatched timeout and 10 processed timeout and their corresponding starts
            context = CreateCleanTimeoutJobExecutionContext(9);
            dispositions.Execute(context);
            Assert.Equal(51, target.Count());
        }