Exemplo n.º 1
0
        public void Test_EventView()
        {
            ViewBase eventView = new EventView();

            Assert.AreEqual(
                typeof(Event),
                eventView.ViewType);

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

            eventView.PageSize += 8;
            eventView.PropertySet.Expand(EventObjectSchema.Type);
            eventView.PropertySet.Expand(new ExtendedPropertyDefinition(MapiPropertyType.String, 0x1234));
            eventView.PropertySet.Add(EventObjectSchema.Body);

            Assert.AreEqual(
                "$top=18&$skip=0&$select=Id,Start,End,Location,Body&$expand=SingleValueExtendedProperties($filter=Id eq 'String 0x1234'),Type",
                eventView.GetUrlQuery());

            eventView.ValidateViewTypeSupported(typeof(Event));

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