Example #1
0
        private static XmlElement CreateStatusUpdateStanza(PresenceStatus presenceStatus)
        {
            var stanzaType = presenceStatus.IsAvailable ? string.Empty : PresenceStanza.Type.Unavailable;
            var showStatus = ToShowStatus(presenceStatus.AvailabilitySubstate);

            return(PresenceStanza.New(stanzaType, showStatus, presenceStatus.StatusText));
        }
Example #2
0
        public async Task SendUnsubscribeRequestAsync_Sends_Correct_Presence_Stanza()
        {
            var subscriptionJid = $"{Guid.NewGuid()}@domain.com";
            var expectedStanza  = PresenceStanza.New(PresenceStanza.Type.Unsubscribe).To(subscriptionJid);
            var actualStanza    = default(XmlElement);

            HandlersRegistry.RegisterTransmitPipeHandler <XmlElement>(e => actualStanza = e);

            await MessageSender.SendUnsubscribeRequestAsync(subscriptionJid);

            Assert.Equal(expectedStanza, actualStanza);
        }