public void Dispatcher_replaceset_for_wrong_owner_throws() { Plug owner = Plug.New("mock:///pubsub"); DreamCookie cookie = DreamCookie.NewSetCookie("foo", "bar", new XUri("http://xyz/abc/")); Dispatcher dispatcher = new Dispatcher(new DispatcherConfig { ServiceUri = owner, ServiceAccessCookie = cookie }); XDoc subset = new XDoc("subscription-set") .Attr("max-failures", 1) .Elem("uri.owner", "http:///owner") .Start("subscription") .Attr("id", "123") .Elem("channel", "channel:///foo") .Start("recipient").Attr("auth-token", "abc").Elem("uri", "mailto://[email protected]").End() .End(); Tuplet<PubSubSubscriptionSet, bool> location = dispatcher.RegisterSet(subset); XDoc subset2 = new XDoc("subscription-set") .Attr("max-failures", 1) .Elem("uri.owner", "http:///ownerx") .Start("subscription") .Attr("id", "123") .Elem("channel", "channel:///foo") .Start("recipient").Attr("auth-token", "abc").Elem("uri", "mailto://[email protected]").End() .End(); try { dispatcher.ReplaceSet(location.Item1.Location, subset2); } catch(ArgumentException) { return; } Assert.Fail(); }
public void Dispatcher_replaceset_for_unknown_location_returns_false() { DreamCookie cookie = DreamCookie.NewSetCookie("foo", "bar", new XUri("http://xyz/abc/")); Plug owner = Plug.New("mock:///pubsub"); Dispatcher dispatcher = new Dispatcher(new DispatcherConfig { ServiceUri = owner, ServiceAccessCookie = cookie }); XDoc subset = new XDoc("subscription-set") .Attr("max-failures", 1) .Elem("uri.owner", "http:///owner") .Start("subscription") .Attr("id", "123") .Elem("channel", "channel:///foo") .Start("recipient").Attr("auth-token", "abc").Elem("uri", "mailto://[email protected]").End() .End(); Assert.IsNull(dispatcher.ReplaceSet("ABCD", subset)); }