/// <exception cref="System.UriFormatException"></exception> public virtual void TestChannelsMore() { Database db = StartDatabase(); Uri fakeRemoteURL = new Uri("http://couchbase.com/no_such_db"); Replication r1 = db.CreatePullReplication(fakeRemoteURL); NUnit.Framework.Assert.IsTrue(r1.GetChannels().IsEmpty()); r1.SetFilter("foo/bar"); NUnit.Framework.Assert.IsTrue(r1.GetChannels().IsEmpty()); IDictionary <string, object> filterParams = new Dictionary <string, object>(); filterParams.Put("a", "b"); r1.SetFilterParams(filterParams); NUnit.Framework.Assert.IsTrue(r1.GetChannels().IsEmpty()); r1.SetChannels(null); NUnit.Framework.Assert.AreEqual("foo/bar", r1.GetFilter()); NUnit.Framework.Assert.AreEqual(filterParams, r1.GetFilterParams()); IList <string> channels = new AList <string>(); channels.AddItem("NBC"); channels.AddItem("MTV"); r1.SetChannels(channels); NUnit.Framework.Assert.AreEqual(channels, r1.GetChannels()); NUnit.Framework.Assert.AreEqual("sync_gateway/bychannel", r1.GetFilter()); filterParams = new Dictionary <string, object>(); filterParams.Put("channels", "NBC,MTV"); NUnit.Framework.Assert.AreEqual(filterParams, r1.GetFilterParams()); r1.SetChannels(null); NUnit.Framework.Assert.AreEqual(r1.GetFilter(), null); NUnit.Framework.Assert.AreEqual(null, r1.GetFilterParams()); }
/// <exception cref="System.Exception"></exception> public virtual void TestChannels() { Uri remote = GetReplicationURL(); Replication replicator = database.CreatePullReplication(remote); IList <string> channels = new AList <string>(); channels.AddItem("chan1"); channels.AddItem("chan2"); replicator.SetChannels(channels); NUnit.Framework.Assert.AreEqual(channels, replicator.GetChannels()); replicator.SetChannels(null); NUnit.Framework.Assert.IsTrue(replicator.GetChannels().IsEmpty()); }