Exemplo n.º 1
0
        public void CommentObjectTypeTest()
        {
            // get test
            Assert.That(CommentObjectType.Post.ToString(), Is.EqualTo("post"));
            Assert.That(CommentObjectType.Photo.ToString(), Is.EqualTo("photo"));
            Assert.That(CommentObjectType.Video.ToString(), Is.EqualTo("video"));
            Assert.That(CommentObjectType.Topic.ToString(), Is.EqualTo("topic"));
            Assert.That(CommentObjectType.Note.ToString(), Is.EqualTo("note"));

            // parse test
            Assert.That(CommentObjectType.FromJsonString("post")
                        , Is.EqualTo(CommentObjectType.Post));

            Assert.That(CommentObjectType.FromJsonString("photo")
                        , Is.EqualTo(CommentObjectType.Photo));

            Assert.That(CommentObjectType.FromJsonString("video")
                        , Is.EqualTo(CommentObjectType.Video));

            Assert.That(CommentObjectType.FromJsonString("topic")
                        , Is.EqualTo(CommentObjectType.Topic));

            Assert.That(CommentObjectType.FromJsonString("note")
                        , Is.EqualTo(CommentObjectType.Note));
        }
Exemplo n.º 2
0
        public void CommentObjectTypeTest()
        {
            // get test
            Assert.That(actual: CommentObjectType.Post.ToString(), expression: Is.EqualTo(expected: "post"));
            Assert.That(actual: CommentObjectType.Photo.ToString(), expression: Is.EqualTo(expected: "photo"));
            Assert.That(actual: CommentObjectType.Video.ToString(), expression: Is.EqualTo(expected: "video"));
            Assert.That(actual: CommentObjectType.Topic.ToString(), expression: Is.EqualTo(expected: "topic"));
            Assert.That(actual: CommentObjectType.Note.ToString(), expression: Is.EqualTo(expected: "note"));

            // parse test
            Assert.That(actual: CommentObjectType.FromJsonString(response: "post")
                        , expression: Is.EqualTo(expected: CommentObjectType.Post));

            Assert.That(actual: CommentObjectType.FromJsonString(response: "photo")
                        , expression: Is.EqualTo(expected: CommentObjectType.Photo));

            Assert.That(actual: CommentObjectType.FromJsonString(response: "video")
                        , expression: Is.EqualTo(expected: CommentObjectType.Video));

            Assert.That(actual: CommentObjectType.FromJsonString(response: "topic")
                        , expression: Is.EqualTo(expected: CommentObjectType.Topic));

            Assert.That(actual: CommentObjectType.FromJsonString(response: "note")
                        , expression: Is.EqualTo(expected: CommentObjectType.Note));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Отписывает текущего пользователя от комментариев к заданному объекту.
        /// </summary>
        /// <param name="type">
        /// Тип объекта, от комментариев к которому необходимо
        /// отписаться.
        /// </param>
        /// <param name="ownerId"> Идентификатор владельца объекта. </param>
        /// <param name="itemId"> Идентификатор объекта. </param>
        /// <returns>
        /// После успешного выполнения возвращает <c> true </c>.
        /// </returns>
        /// <remarks>
        /// Страница документации ВКонтакте http://vk.com/dev/newsfeed.unsubscribe
        /// </remarks>
        public bool Unsubscribe(CommentObjectType type, long itemId, long?ownerId = null)
        {
            var parameters = new VkParameters
            {
                { "type", type }
                , { "owner_id", ownerId }
                , { "item_id", itemId }
            };

            return(_vk.Call(methodName: "newsfeed.unsubscribe", parameters: parameters));
        }
Exemplo n.º 4
0
        public bool Unsubscribe(CommentObjectType type, ulong ownerId, ulong itemId)
        {
            var parameters = new VkParameters
            {
                { "type", type },
                { "owner_id", ownerId },
                { "item_id", itemId }
            };

            return(_vk.Call("newsfeed.unsubscribe", parameters));
        }
Exemplo n.º 5
0
 public bool Unsubscribe(CommentObjectType type, ulong ownerId, ulong itemId)
 {
     var parameters = new VkParameters
     {
         { "type", type },
         { "owner_id", ownerId },
         { "item_id", itemId }
     };
     return _vk.Call("newsfeed.unsubscribe", parameters);
 }
Exemplo n.º 6
0
 /// <inheritdoc />
 public Task <bool> UnsubscribeAsync(CommentObjectType type, long itemId, long?ownerId = null)
 {
     return(TypeHelper.TryInvokeMethodAsync(func: () =>
                                            _vk.NewsFeed.Unsubscribe(type: type, itemId: itemId, ownerId: ownerId)));
 }