private async Task<List> EnsureTargetList() { var list = new HarshList() { Title = "HarshPoint Tests Lookup Target List", Url = TargetListUrl, }; await list.ProvisionAsync(Context); return LastObjectOutput<List>()?.Object; }
public async Task Content_type_gets_added() { var name = Guid.NewGuid().ToString("n"); var ctid = HarshContentTypeId.Parse("0x01").Append(HarshContentTypeId.Parse(name)); var ctProv = new HarshContentType() { Id = ctid, Name = name, }; var listProv = new HarshList() { Title = name, Url = "Lists/" + name, Children = { new HarshContentTypeRef() { ContentTypes = Resolve.ContentType().ById(ctid) } } }; await ctProv.ProvisionAsync(Context); var ctResult = LastObjectOutput<ContentType>(); var ct = ctResult.Object; RegisterForDeletion(ct); await listProv.ProvisionAsync(Context); var listResult = LastObjectOutput<List>(); var list = listResult.Object; RegisterForDeletion(list); Assert.IsType<ObjectAdded<List>>(listResult); Assert.NotNull(list); ClientContext.Load( list, l => l.ContentTypesEnabled, l => l.ContentTypes.Include(lct => lct.StringId), l => l.Id ); await ClientContext.ExecuteQueryAsync(); Assert.True(list.ContentTypesEnabled); Assert.Contains(list.ContentTypes, lct => lct.StringId.StartsWith(ctid.ToString() + "00")); }