Exemplo n.º 1
0
        private void subscibeButton_Click(object sender, EventArgs e)
        {
            var api = new NotificationsApi();

            Channel result = api.PostNotificationsChannels();

            subscribeResultTextbox.Text = result.ToJson();

            string              channelId = result.Id;
            ChannelTopic        body      = new ChannelTopic($"v2.users.{userIdTextbox.Text}.conversations.calls");
            List <ChannelTopic> topics    = new List <ChannelTopic>();

            ChannelTopicEntityListing resultListing = api.PutNotificationsChannelSubscriptions(channelId, topics);

            subscribeResultTextbox.Text += "\n\n=============================\n\n" + result.ToJson();
        }
Exemplo n.º 2
0
        public void ShouldRemapMessagesToConcreteTypes()
        {
            var meMessage = new MeMessage
            {
                Type    = EventType.Message,
                Subtype = MessageSubType.MeMessage,
                Text    = "me",
                Team    = "team1"
            };

            var topicMessage = new ChannelTopic
            {
                Type    = EventType.Message,
                Subtype = MessageSubType.ChannelTopic,
                Topic   = "topic"
            };

            var plainMessage = new PlainMessage
            {
                Type    = EventType.Message,
                Subtype = MessageSubType.PlainMessage,
                Text    = "text"
            };

            var parser = new ResponseParser();

            var messages = new List <MessageBase>
            {
                parser.Deserialize <MessageBase>(parser.SerializeMessage(meMessage)),
                parser.Deserialize <MessageBase>(parser.SerializeMessage(topicMessage)),
                parser.Deserialize <MessageBase>(parser.SerializeMessage(plainMessage))
            };

            var concreteMessages = parser.RemapMessagesToConcreteTypes(messages).ToList();

            Assert.IsType <MeMessage>(concreteMessages[0]);
            Assert.IsType <ChannelTopic>(concreteMessages[1]);
            Assert.IsType <PlainMessage>(concreteMessages[2]);

            Assert.Equal(EventType.Message, concreteMessages[0].Type);
            Assert.Equal(MessageSubType.MeMessage, concreteMessages[0].Subtype);
            Assert.Equal("me", concreteMessages[0].Text);
            Assert.Equal("team1", concreteMessages[0].Team);

            Assert.Equal(EventType.Message, concreteMessages[1].Type);
            Assert.Equal("topic", ((ChannelTopic)concreteMessages[1]).Topic);
        }
Exemplo n.º 3
0
 public void Init()
 {
     instance = new ChannelTopic();
 }
 private void ViewTopic(ChannelTopic parameter)
 {
     this.NavigationService.Navigate("TopicDetail", parameter.Topic.ID);
 }