public void Create_Creates_List_With_Custom_Fields_Test() { using (var factory = WebFactory.Open(_webUrl)) { IQueryList <Item> list1; try { list1 = factory.Create <Item>("ListForLookup"); } catch (SPException) { list1 = factory.GetByName <Item>("ListForLookup"); } IQueryList <CustomItem> list = null; try { list = factory.Create <CustomItem>("List755"); Assert.AreEqual(list.Title, "List755"); Assert.That(list1.ContainsContentType <Item>()); 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); Assert.That(list.ContainsField(ci => ci.CustomChoice), Is.True); Assert.That(list.ContainsField(ci => ci.Тыдыщ), Is.True); var choiceField = list.GetField(ci => ci.CustomChoice); Assert.NotNull(choiceField.Choices); Assert.That(choiceField.Choices.Count(), Is.EqualTo(3)); var choiceWithName = choiceField.Choices.Skip(1).First(); Assert.That(choiceWithName, Is.EqualTo("The Choice Number Two")); } finally { if (list != null) { list.DeleteList(false); } list1.DeleteList(false); } } }
public void Create_Creates_List_With_Custom_Nullable_Test() { using (var factory = WebFactory.Open(_webUrl)) { IQueryList <NullableItem> list = null; try { list = factory.Create <NullableItem>("Create_Creates_List_With_Custom_Nullable_Test"); list.ContainsField(i => i.CustomDouble); list.ContainsField(i => i.CustomInt); list.ContainsField(i => i.CustomDecimal); list.ContainsField(i => i.CustomBoolean); list.ContainsField(i => i.CustomDate); list.ContainsField(i => i.CustomChoice); } finally { if (list != null) { list.DeleteList(false); } } } }
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_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); } } } }