예제 #1
0
        public void TestAddListener2()
        {
            var table = new SQLiteLogTable(_scheduler, _cache, "foo.db");
            var listener1 = new Mock<ILogTableListener>();
            var listener2 = new Mock<ILogTableListener>();
            table.AddListener(listener1.Object, TimeSpan.Zero, 100);
            table.AddListener(listener2.Object, TimeSpan.Zero, 200);

            table.RemoveListener(listener1.Object).Should().BeTrue("Because we should've successfully removed this listener");
            table.RemoveListener(listener1.Object).Should().BeFalse("Because this listener is no longer part of the collection and thus removing it should've failed");

            table.RemoveListener(listener2.Object).Should().BeTrue("Because we should've successfully removed this listener");
            table.RemoveListener(listener2.Object).Should().BeFalse("Because this listener is no longer part of the collection and thus removing it should've failed");
        }
예제 #2
0
 public void TestAddListener1()
 {
     var table = new SQLiteLogTable(_scheduler, _cache, "foo.db");
     var listener = new Mock<ILogTableListener>();
     new Action(() => table.AddListener(listener.Object, TimeSpan.Zero, 100)).ShouldNotThrow();
     table.RemoveListener(listener.Object).Should().BeTrue();
 }