コード例 #1
0
        public static void MessageInfoCaptionEntitiesTest()
        {
            const string type   = "type";
            const int    offset = 10;
            const int    length = 12345;
            const string url    = "url";

            JObject user = MCommonUserInfo;
            dynamic messageInfoEntities = MCommonMandatoryFieldsMessageInfo;

            messageInfoEntities.caption_entities = new JArray(MessageEntityInfoObject.GetObject(type, offset, length, url, user));

            MessageInfo messageInfo = new MessageInfo(messageInfoEntities);

            Assert.Multiple(() =>
            {
                //test MessageInfo.Entities
                Assert.AreEqual(type, messageInfo.CaptionEntities[0].Type);
                Assert.AreEqual(offset, messageInfo.CaptionEntities[0].Offset);
                Assert.AreEqual(length, messageInfo.CaptionEntities[0].Length);
                Assert.AreEqual(url, messageInfo.CaptionEntities[0].Url);
            });

            //test MessageInfo.Entities.User
            AssertUserInfo(messageInfo.CaptionEntities[0].User);
        }
コード例 #2
0
        public static void MessageInfoGameTest()
        {
            const string title       = "TestTitle";
            const string description = "TestDescription";
            const string text        = "TestText";

            //AnimationInfo field
            const string fileId    = "100";
            const string mimeType  = "mimeTypeTest";
            const string fileName  = "testFleName";
            const int    fileSize  = 10;
            JObject      animation = AnimationInfoObject.GetObject(fileId, MCommonPhotoSizeInfo, fileName, mimeType, fileSize);

            //MessageEntityInfo field
            const string type     = "TestType";
            const int    offset   = 123456;
            const int    length   = 123456;
            const string url      = "TestUrl";
            JArray       entities = new JArray(MessageEntityInfoObject.GetObject(type, offset, length, url, MCommonUserInfo));

            dynamic messageInfoGame = MCommonMandatoryFieldsMessageInfo;

            messageInfoGame.game = GameInfoObject.GetObject(title, description, new JArray(MCommonPhotoSizeInfo), text, entities, animation);

            MessageInfo messageInfo = new MessageInfo(messageInfoGame);

            Assert.Multiple(() =>
            {
                //Game
                Assert.AreEqual(title, messageInfo.Game.Title);
                Assert.AreEqual(description, messageInfo.Game.Description);
                Assert.AreEqual(text, messageInfo.Game.Text);

                //Game.Entities
                Assert.AreEqual(type, messageInfo.Game.Entities[0].Type);
                Assert.AreEqual(offset, messageInfo.Game.Entities[0].Offset);
                Assert.AreEqual(length, messageInfo.Game.Entities[0].Length);
                Assert.AreEqual(url, messageInfo.Game.Entities[0].Url);

                //Game.Animation
                Assert.AreEqual(fileId, messageInfo.Game.Animation.FileId);
                Assert.AreEqual(fileName, messageInfo.Game.Animation.FileName);
                Assert.AreEqual(mimeType, messageInfo.Game.Animation.MimeType);
                Assert.AreEqual(fileSize, messageInfo.Game.Animation.FileSize);
            });

            //Game.Entites.User
            AssertUserInfo(messageInfo.Game.Entities[0].User);

            //Game.Photo
            AssertPhotoSizeInfo(messageInfo.Game.Photo[0]);

            //Game.Animation.Thumb
            AssertPhotoSizeInfo(messageInfo.Game.Animation.Thumb);
        }
コード例 #3
0
        public static void MessageInfoEntitiesTest()
        {
            const string type   = "type";
            const int    offset = 10;
            const int    length = 12345;
            const string url    = "url";

            const int    id           = 123;
            const string firstName    = "name";
            const string lastName     = "lastName";
            const string username     = "******";
            const string languageCode = "code";

            JObject user = UserInfoObject.GetObject(id, firstName, lastName, username, languageCode);

            dynamic MessageInfoEntities = mMandatoryFieldsMessageInfo;

            MessageInfoEntities.entities = new JArray(MessageEntityInfoObject.GetObject(type, offset, length, url, user));

            MessageInfo messageInfo = new MessageInfo(MessageInfoEntities);

            //test MessageInfo.Entities
            Assert.AreEqual(messageInfo.Entities[0].Type, type);
            Assert.AreEqual(messageInfo.Entities[0].Offset, offset);
            Assert.AreEqual(messageInfo.Entities[0].Length, length);
            Assert.AreEqual(messageInfo.Entities[0].Url, url);

            //test MessageInfo.Entities.User
            Assert.AreEqual(messageInfo.Entities[0].User.Id, id);
            Assert.AreEqual(messageInfo.Entities[0].User.FirstName, firstName);
            Assert.AreEqual(messageInfo.Entities[0].User.LastName, lastName);
            Assert.AreEqual(messageInfo.Entities[0].User.UserName, username);
            Assert.AreEqual(messageInfo.Entities[0].User.LanguageCode, languageCode);

            Console.WriteLine(MessageInfoEntities);
        }