public void CreateNewContact() { //Setup string crmCon = TestCreateContact.GetConfigValue("CrmConnection"); using (CrmServiceClient svc = new CrmServiceClient(crmCon)) { // Act Entity c = new Entity("contact"); c["firstname"] = "Test"; c["lastname"] = DateTime.Now.Date.ToShortDateString(); c.Id = svc.Create(c); //Validate Thread.Sleep(5000); QueryByAttribute query = new QueryByAttribute("phonecall"); query.Attributes.Add("regardingobjectid"); query.Values.Add(c.Id); EntityCollection calls = svc.RetrieveMultiple(query); Assert.AreEqual(calls.Entities.Count, 1); //Clean up svc.Delete(c.LogicalName, c.Id); } }
public void CreateNewContact() { string crmCon = TestCreateContact.GetConfigValue("CrmConnection"); using (CrmServiceClient svc = new CrmServiceClient(crmCon)) { Entity c = new Entity("contact"); c["firstname"] = "Test"; c["lastname"] = DateTime.Now.Date.ToShortDateString(); c.Id = svc.Create(c); } }