public void UpdatingCallJSON_CalledUpdated() { //Arrange // Arrange var testString = "Test"; var choice = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Morfin" }; var category = new CategoryEntity() { CategoryId = Guid.NewGuid().ToString(), Name = "Smertestillende", //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg", Choices = new List <ChoiceEntity> { choice } }; CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, category, choice, null); //Act PatientCall call = new PatientCall(); try { callEntity._id = "5641c5dd02a93d27a8910f9c"; callEntity.Status = (int)CallUtil.StatusCode.Canceled; call.UpdateCall(callEntity); } catch (Exception e) { // Assert Assert.Fail("No calls has been updated"); } }
// Fortryd kald public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { tableView.DeselectRow(indexPath, true); var regretAlertController = UIAlertController.Create(Strings.CallRegretTitle, Strings.CallRegretMessage, UIAlertControllerStyle.Alert); var regretAction = UIAlertAction.Create(Strings.OK, UIAlertActionStyle.Destructive, action => { new System.Threading.Thread(new System.Threading.ThreadStart(() => { // Get the selected call var callEntity = CallEntities[indexPath.Row]; // Update status callEntity.Status = (int)CallUtil.StatusCode.Canceled; // Try update the call try { // Put the async patient call here ICall patientCall = new PatientCall(); patientCall.UpdateCall(callEntity); vc.InvokeOnMainThread(() => { // (Get a confirm message that the patient call was successfull) new UIAlertView(Strings.CallRegretted, null, null, "OK", null).Show(); DataHandler.UpdateMyCallToLocalDatabase(new LocalDB(), callEntity); // Reload data SetCallEntities(callEntity); tableView.ReloadData(); }); } catch (Exception ex) { Console.WriteLine("ERROR updaing call: " + ex.Message); vc.InvokeOnMainThread(() => { new UIAlertView(Strings.Error, Strings.ErrorSendingCall, null, "OK", null).Show(); return; }); } })).Start(); }); // When user cancels the service var cancelAction = UIAlertAction.Create("Annullér", UIAlertActionStyle.Cancel, action => { // Do nothing. }); regretAlertController.AddAction(regretAction); regretAlertController.AddAction(cancelAction); // Display the alert vc.PresentViewController(regretAlertController, true, null); }
public void UpdatingCallJSON_CalledUpdated() { //Arrange // Arrange var testString = "Test"; var choice = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Morfin" }; var category = new CategoryEntity() { CategoryId = Guid.NewGuid().ToString(), Name = "Smertestillende", //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg", Choices = new List<ChoiceEntity> { choice } }; CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, category, choice, null); //Act PatientCall call = new PatientCall(); try { callEntity._id = "5641c5dd02a93d27a8910f9c"; callEntity.Status = (int) CallUtil.StatusCode.Canceled; call.UpdateCall(callEntity); } catch (Exception e) { // Assert Assert.Fail("No calls has been updated"); } }