예제 #1
0
        public void Test3()
        {
            var ev2 = new Matrix.Xmpp.PubSub.Event.Event
            {
                Configuration = new Configuration {
                    Node = "princely_musings"
                }
            };

            ev2.ShouldBe(Resource.Get("Xmpp.PubSub.Event.event3.xml"));
        }
예제 #2
0
        public void TestBuildEvent6()
        {
            var ev2 = new Matrix.Xmpp.PubSub.Event.Event
            {
                Type         = PubSubEventType.Subscription,
                Subscription =
                {
                    Node = "princely_musings",
                    Jid  = "*****@*****.**",
                    SubscriptionState = Matrix.Xmpp.PubSub.SubscriptionState.Subscribed
                }
            };

            ev2.ShouldBe(Resource.Get("Xmpp.PubSub.Event.event6.xml"));
        }
예제 #3
0
        public void TestEvent7()
        {
            DateTime     dt    = DateTime.MinValue;
            XmppXElement xmpp1 = XmppXElement.LoadXml(Resource.Get("Xmpp.PubSub.Event.event7.xml")).Cast <Matrix.Xmpp.PubSub.Event.Event>();

            var ev = xmpp1 as Matrix.Xmpp.PubSub.Event.Event;

            Assert.NotEqual(ev.Type, PubSubEventType.Items);
            Assert.Equal(ev.Type, PubSubEventType.Subscription);

            Assert.Equal(ev.Subscription.Node, "princely_musings");
            Assert.Equal(ev.Subscription.Jid.Equals("*****@*****.**"), true);
            Assert.Equal(ev.Subscription.Id, "ba49252aaa4f5d320c24d3766f0bdcade78c78d3");
            Assert.Equal(ev.Subscription.SubscriptionState, Matrix.Xmpp.PubSub.SubscriptionState.Subscribed);

            dt = ev.Subscription.Expiry;


            var ev2 = new Matrix.Xmpp.PubSub.Event.Event
            {
                Type         = PubSubEventType.Subscription,
                Subscription =
                {
                    Node = "princely_musings",
                    Jid  = "*****@*****.**",
                    Id   = "ba49252aaa4f5d320c24d3766f0bdcade78c78d3",
                    SubscriptionState = Matrix.Xmpp.PubSub.SubscriptionState.Subscribed,
                    Expiry            = dt
                }
            };

            ev2.ShouldBe(Resource.Get("Xmpp.PubSub.Event.event7.xml"));


            ev2 = new Matrix.Xmpp.PubSub.Event.Event
            {
                Type         = PubSubEventType.Subscription,
                Subscription =
                {
                    Node = "princely_musings",
                    Jid  = "*****@*****.**",
                    Id   = "ba49252aaa4f5d320c24d3766f0bdcade78c78d3",
                    SubscriptionState = Matrix.Xmpp.PubSub.SubscriptionState.Subscribed,
                    Expiry            = dt
                }
            };
            ev2.ShouldBe(Resource.Get("Xmpp.PubSub.Event.event7.xml"));
        }
예제 #4
0
        public void TestBuildEvent()
        {
            var ev2 = new Matrix.Xmpp.PubSub.Event.Event
            {
                Type  = PubSubEventType.Items,
                Items = { Node = "princely_musings" }
            };

            ev2.Items.AddRetract(new Retract {
                Id = "ae890ac52d0df67ed7cfdf51b644e901"
            });
            ev2.ShouldBe(Resource.Get("Xmpp.PubSub.Event.event2.xml"));


            ev2 = new Matrix.Xmpp.PubSub.Event.Event {
                Type = PubSubEventType.Delete
            };

            Assert.Equal(ev2.Delete != null, true);

            ev2.Type       = PubSubEventType.Items;
            ev2.Items.Node = "princely_musings";
            ev2.Items.AddRetract(new Retract {
                Id = "ae890ac52d0df67ed7cfdf51b644e901"
            });
            ev2.ShouldBe(Resource.Get("Xmpp.PubSub.Event.event2.xml"));


            var ev3 = new Matrix.Xmpp.PubSub.Event.Event
            {
                Type  = PubSubEventType.Purge,
                Purge = { Node = "princely_musings" }
            };

            ev3.ShouldBe(Resource.Get("Xmpp.PubSub.Event.event5.xml"));
        }