示例#1
0
        public void Test_MessageView()
        {
            ViewBase messageView = new MessageView();

            Assert.AreEqual(
                typeof(Message),
                messageView.ViewType);

            Assert.AreEqual(
                "$top=10&$skip=0",
                messageView.GetUrlQuery());

            Assert.ThrowsException <ArgumentException>(() =>
            {
                messageView.PropertySet.Expand(EventObjectSchema.Type);
            });

            messageView.PropertySet.Expand(new ExtendedPropertyDefinition(MapiPropertyType.String, 0x1234));
            messageView.PropertySet.Add(MessageObjectSchema.Body);
            messageView.PageSize += 6;
            messageView.Offset   += 12;

            Assert.AreEqual(
                "$top=16&$skip=12&$select=Id,IsRead,Subject,ParentFolderId,CreatedDateTime,Body&$expand=SingleValueExtendedProperties($filter=Id eq 'String 0x1234')",
                messageView.GetUrlQuery());

            messageView.ValidateViewTypeSupported(typeof(Message));

            Assert.ThrowsException <ArgumentException>((() =>
            {
                messageView.ValidateViewTypeSupported(typeof(Contact));
            }));
        }