public void Not_Add_The_Document_Notification_If_It_Matches_With_Any_Broadcast() { var cache = new NotificationCache(); cache.AddBroadcast("coll1"); cache.AddBroadcast("coll2"); cache.AddDocuments("coll1", new[] { new BsonValue(1), new BsonValue(2) }); cache.Documents.Should().BeEmpty(); }
public void Add_The_Document_Notification_If_It_Does_Not_Match_With_Any_Broadcast() { var cache = new NotificationCache(); cache.AddBroadcast("coll1"); cache.AddBroadcast("coll2"); cache.AddDocuments("coll3", new[] { new BsonValue(1), new BsonValue(2) }); cache.Documents.Should().HaveCount(2); }
public void Add_The_Collection_Notification_If_It_Does_Not_Match_With_Any_Broadcast() { var cache = new NotificationCache(); cache.AddBroadcast("coll1"); cache.AddBroadcast("coll2"); cache.AddCollection("coll3"); cache.Collections.Should().HaveCount(1); }
public void Not_Add_The_Collection_Notification_If_It_Matches_With_Any_Broadcast() { var cache = new NotificationCache(); cache.AddBroadcast("coll1"); cache.AddBroadcast("coll2"); cache.AddCollection("coll1"); cache.Documents.Should().BeEmpty(); }
public void Add_Broadcast_Notification() { var cache = new NotificationCache(); cache.Broadcasts.Should().BeEmpty(); cache.AddBroadcast("coll1"); cache.AddBroadcast("coll2"); cache.Broadcasts.Should().HaveCount(2); cache.Broadcasts.Contains("coll1").Should().BeTrue(); cache.Broadcasts.Contains("coll2").Should().BeTrue(); cache.Broadcasts.Contains("coll3").Should().BeFalse(); cache.Clear(); cache.Broadcasts.Should().BeEmpty(); }
public void Remove_Matched_Collection_Notification_If_A_Broadcast_Notification_Is_Added() { var cache = new NotificationCache(); cache.AddCollection("coll1"); cache.AddCollection("coll2"); cache.Collections.Should().HaveCount(2); cache.AddBroadcast("coll1"); cache.Collections.Should().HaveCount(1); cache.Collections.Where(coll => coll == "coll2").Count().Should().Be(1); }
public void Remove_Matched_Document_Notification_If_A_Broadcast_Notification_Is_Added() { var cache = new NotificationCache(); cache.AddDocuments("coll1", new[] { new BsonValue(1), new BsonValue(2) }); cache.AddDocuments("coll2", new[] { new BsonValue(1), new BsonValue(3) }); cache.Documents.Should().HaveCount(4); cache.AddBroadcast("coll1"); cache.Documents.Should().HaveCount(2); cache.Documents.Where(doc => doc.Item1 == "coll2").Count().Should().Be(2); }