public void TestPurge() { QueueChannel channel = new QueueChannel(2); TimeSpan minute = new TimeSpan(0, 0, 1, 0); DateTime now = DateTime.Now; DateTime past = now.Subtract(minute); DateTime future = now.Add(minute); IMessage expiredMessage = MessageBuilder.WithPayload("test1").SetExpirationDate(past).Build(); IMessage unexpiredMessage = MessageBuilder.WithPayload("test2").SetExpirationDate(future).Build(); Assert.IsTrue(channel.Send(expiredMessage, TimeSpan.Zero)); Assert.IsTrue(channel.Send(unexpiredMessage, TimeSpan.Zero)); Assert.IsFalse(channel.Send(new StringMessage("atCapacity"), TimeSpan.Zero)); IList<IMessage> purgedMessages = channel.Purge(new UnexpiredMessageSelector()); Assert.IsNotNull(purgedMessages); Assert.That(purgedMessages.Count, Is.EqualTo(1)); Assert.IsTrue(channel.Send(new StringMessage("roomAvailable"), TimeSpan.Zero)); }