public void CloseTroubleTicketTest() { Mock <IOrganizationService> orgSvc = null; Mock <MoqHttpMessagehander> fakHttpMethodHander = null; CdsServiceClient cli = null; testSupport.SetupMockAndSupport(out orgSvc, out fakHttpMethodHander, out cli); orgSvc.Setup(f => f.Execute(It.Is <CloseIncidentRequest>(p => p.IncidentResolution is Entity && ((Entity)p.IncidentResolution).GetAttributeValue <string>("subject").Equals("Subject", StringComparison.OrdinalIgnoreCase)))).Returns(new CloseIncidentResponse()); Guid rslt = cli.CloseTroubleTicket(testSupport._DefaultId, "Subject", "Description"); Assert.IsType <Guid>(rslt); Assert.NotEqual <Guid>(Guid.Empty, rslt); rslt = cli.CloseTroubleTicket(Guid.Empty, "Subject", "Description"); Assert.IsType <Guid>(rslt); Assert.Equal <Guid>(Guid.Empty, rslt); // try with batch // Setup a batch string BatchRequestName = "TestBatch"; Guid batchid = cli.CreateBatchOperationRequest(BatchRequestName); rslt = cli.CloseTroubleTicket(testSupport._DefaultId, "Subject", "Description", batchId: batchid); Assert.IsType <Guid>(rslt); Assert.Equal <Guid>(Guid.Empty, rslt); // Release batch request cli.ReleaseBatchInfoById(batchid); }