public void Create_Creates_DocLibrary_With_Custom_Fields_Test() { using (var factory = WebFactory.Open(_webUrl)) { IQueryList <Item> list1 = null; IQueryList <CustomDocument> list = null; try { try { list1 = factory.Create <Item>("ListForLookup"); } catch (SPException) { list1 = factory.GetByName <Item>("ListForLookup"); } list = factory.Create <CustomDocument>("List759"); Assert.AreEqual(list.Title, "List759"); Assert.That(list.ContainsContentType <Item>() == false); Assert.That(list.ContainsContentType <Document>()); Assert.That(list.ContainsField(ci => ci.CustomField1), Is.True); Assert.That(list.ContainsField(ci => ci.CustomField2), Is.True); Assert.That(list.ContainsField(ci => ci.CustomFieldNumber), Is.True); Assert.That(list.ContainsField(ci => ci.CustomBoolean), Is.True); Assert.That(list.ContainsField(ci => ci.CustomUser), Is.True); Assert.That(list.ContainsField(ci => ci.CustomUsers), Is.True); Assert.That(list.ContainsField(ci => ci.CustomLookup), Is.True); Assert.That(list.ContainsField(ci => ci.CustomMultiLookup), Is.True); } finally { if (list != null) { list.DeleteList(false); } if (list1 != null) { list1.DeleteList(false); } } } }
public void Create_Creates_DocLibrary_With_ContentType_Test() { using (var factory = WebFactory.Open(_webUrl)) { IQueryList <Form> list = null; try { list = factory.Create <Form>("List758"); Assert.AreEqual(list.Title, "List758"); Assert.That(list.ContainsContentType <Item>(), Is.False); Assert.That(list.ContainsContentType <Form>()); } finally { if (null != list) { list.DeleteList(false); } } } }
public void Create_Creates_List_With_ContentType_Test() { using (var factory = WebFactory.Open(_webUrl)) { IQueryList <Announcement> list = null; try { list = factory.Create <Announcement>("List756"); Assert.AreEqual(list.Title, "List756"); Assert.That(list.ContainsContentType <Item>(), Is.False); Assert.That(list.ContainsContentType <Announcement>()); Assert.That(list.ContainsField(a => a.Body)); } finally { if (null != list) { list.DeleteList(false); } } } }