public static void GetUserProfilePhotosResultTest()
        {
            const int    totalCount = 2;
            const string fieldId    = "testFieldId";
            const int    width      = 123;
            const int    height     = 123;
            const int    fileSize   = 123;

            //create UserProfilePhotosInfo
            var     photoArrayOne         = new JArray(PhotoSizeInfoObject.GetObject(fieldId, width, height, fileSize));
            var     photoArrayTwo         = new JArray(PhotoSizeInfoObject.GetObject(fieldId, width, height, fileSize));
            var     jArray                = new JArray(photoArrayOne, photoArrayTwo);
            dynamic userProfilePhotosInfo = UserProfilePhotosInfoObject.GetObject(totalCount, jArray);

            //create GetUserProfilePhotosResult
            dynamic getUserProfileResult = GetUserProfilePhotosResultObject.GetObject(true, userProfilePhotosInfo);

            //create instance GetUserProfilePhotosResult
            var userProfile = new GetUserProfilePhotosResult(getUserProfileResult.ToString());

            Assert.Multiple(() =>
            {
                Assert.True(userProfile.Ok);

                Assert.AreEqual(userProfile.Result.TotalCount, totalCount);

                for (var i = 0; i < 1; i++)
                {
                    Assert.AreEqual(userProfile.Result.Photos[i][0].FileId, fieldId);
                    Assert.AreEqual(userProfile.Result.Photos[i][0].Width, width);
                    Assert.AreEqual(userProfile.Result.Photos[i][0].Height, height);
                    Assert.AreEqual(userProfile.Result.Photos[i][0].FileSize, fileSize);
                }
            });
        }
Beispiel #2
0
        public static void MessageInfoVideoTest()
        {
            const string fileId   = "100";
            const int    width    = 1000;
            const int    height   = 10000;
            const int    duration = 1000;
            const string mimeType = "mimeType";
            const int    fileSize = 100;

            dynamic MessageInfoVideo = mMandatoryFieldsMessageInfo;

            MessageInfoVideo.video = VideoInfoObject.GetObject(fileId, width, height, duration,
                                                               PhotoSizeInfoObject.GetObject(fileId, width, height, fileSize), mimeType, fileSize);

            MessageInfo messageInfo = new MessageInfo(MessageInfoVideo);

            //test MessageInfo.Video
            Assert.AreEqual(messageInfo.Video.FileId, fileId);
            Assert.AreEqual(messageInfo.Video.Width, width);
            Assert.AreEqual(messageInfo.Video.Height, height);
            Assert.AreEqual(messageInfo.Video.Duration, duration);
            Assert.AreEqual(messageInfo.Video.MimeType, mimeType);
            Assert.AreEqual(messageInfo.Video.FileSize, fileSize);

            //test MessageInfo.Video.Thumb
            Assert.AreEqual(messageInfo.Video.Thumb.FileId, fileId);
            Assert.AreEqual(messageInfo.Video.Thumb.Width, width);
            Assert.AreEqual(messageInfo.Video.Thumb.Height, height);
            Assert.AreEqual(messageInfo.Video.Thumb.FileSize, fileSize);

            Console.WriteLine(MessageInfoVideo);
        }
Beispiel #3
0
        public static void MessageInfoStickerTest()
        {
            const string fileId   = "100";
            const int    width    = 100;
            const int    height   = 100;
            const string emoji    = "emoji";
            const int    fileSize = 10;

            dynamic MessageInfoSticker = mMandatoryFieldsMessageInfo;

            MessageInfoSticker.sticker = StickerInfoObject.GetObject(fileId, width, height,
                                                                     PhotoSizeInfoObject.GetObject(fileId, width, height, fileSize), emoji, fileSize);

            MessageInfo messageInfo = new MessageInfo(MessageInfoSticker);

            //test MessageInfo.Sticker
            Assert.AreEqual(messageInfo.Sticker.FileId, fileId);
            Assert.AreEqual(messageInfo.Sticker.Width, width);
            Assert.AreEqual(messageInfo.Sticker.Height, height);
            Assert.AreEqual(messageInfo.Sticker.Emoji, emoji);
            Assert.AreEqual(messageInfo.Sticker.FileSize, fileSize);

            //test MessageInfo.Sticker.Thumb
            Assert.AreEqual(messageInfo.Sticker.Thumb.FileId, fileId);
            Assert.AreEqual(messageInfo.Sticker.Thumb.Width, width);
            Assert.AreEqual(messageInfo.Sticker.Thumb.Height, height);
            Assert.AreEqual(messageInfo.Sticker.Thumb.FileSize, fileSize);

            Console.WriteLine(MessageInfoSticker);
        }
Beispiel #4
0
        public static void MessageInfoDocumentTest()
        {
            const string fileId   = "100";
            const string mimeType = "mimeTypeTest";
            const string fileName = "testFleName";
            const int    fileSize = 10;

            const int width  = 100;
            const int height = 100;

            dynamic MessageInfoDocument = mMandatoryFieldsMessageInfo;

            MessageInfoDocument.document = DocumentInfoObject.GetObject(fileId,
                                                                        PhotoSizeInfoObject.GetObject(fileId, width, height, fileSize), fileName, mimeType, fileSize);

            MessageInfo messageInfo = new MessageInfo(MessageInfoDocument);

            //test MessageInfo.Document
            Assert.AreEqual(messageInfo.Document.FileId, fileId);
            Assert.AreEqual(messageInfo.Document.FileName, fileName);
            Assert.AreEqual(messageInfo.Document.MimeType, mimeType);
            Assert.AreEqual(messageInfo.Document.FileSize, fileSize);

            //test MessageInfo.Document.Thumb
            Assert.AreEqual(messageInfo.Document.Thumb.FileId, fileId);
            Assert.AreEqual(messageInfo.Document.Thumb.Width, width);
            Assert.AreEqual(messageInfo.Document.Thumb.Height, height);
            Assert.AreEqual(messageInfo.Document.Thumb.FileSize, fileSize);


            Console.WriteLine(MessageInfoDocument);
        }
Beispiel #5
0
        public static void UserProfilePhotosInfoTest()
        {
            const int    totalCount = 2;
            const string fieldId    = "testFieldId";
            const int    width      = 123;
            const int    height     = 123;
            const int    fileSize   = 123;

            var photoArrayOne = new JArray(PhotoSizeInfoObject.GetObject(fieldId, width, height, fileSize));
            var photoArrayTwo = new JArray(PhotoSizeInfoObject.GetObject(fieldId, width, height, fileSize));

            var jArray = new JArray(photoArrayOne, photoArrayTwo);

            dynamic userProfilePhotos = UserProfilePhotosInfoObject.GetObject(totalCount, jArray);

            var userProfile = new UserProfilePhotosInfo(userProfilePhotos);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(userProfile.TotalCount, totalCount);

                for (var i = 0; i < 1; i++)
                {
                    Assert.AreEqual(userProfile.Photos[i][0].FileId, fieldId);
                    Assert.AreEqual(userProfile.Photos[i][0].Width, width);
                    Assert.AreEqual(userProfile.Photos[i][0].Height, height);
                    Assert.AreEqual(userProfile.Photos[i][0].FileSize, fileSize);
                }
            });
        }
Beispiel #6
0
        public static void MessageInfoNewChatPhotoTest()
        {
            const string fileId   = "100";
            const int    width    = 100;
            const int    height   = 100;
            const int    fileSize = 10;

            dynamic MessageInfoNewChatPhoto = mMandatoryFieldsMessageInfo;

            JArray photoArray = new JArray(PhotoSizeInfoObject.GetObject(fileId, width, height, fileSize));

            MessageInfoNewChatPhoto.new_chat_photo = photoArray;

            MessageInfo messageInfo = new MessageInfo(MessageInfoNewChatPhoto);

            //test MessageInfo.NewChatPhoto
            Assert.AreEqual(messageInfo.NewChatPhoto[0].FileId, fileId);
            Assert.AreEqual(messageInfo.NewChatPhoto[0].Width, width);
            Assert.AreEqual(messageInfo.NewChatPhoto[0].Height, height);
            Assert.AreEqual(messageInfo.NewChatPhoto[0].FileSize, fileSize);

            Console.WriteLine(MessageInfoNewChatPhoto);
        }