public void update_ClinicalInterest()
        {
            //setup
            var handler = CreateHandler();
            var request = new UpdateClinicalInterestRequest();
            ClinicalInterest clinicalInterest = null;

            using (var context = _objectContextFactory.CreateObjectContext())
            {
                clinicalInterest = context.CreateObjectSet<ClinicalInterest>().Single(g => g.Id == 1);
            }

            //act
            request.Id = clinicalInterest.Id;
            request.Name = "Update Test";
            request.IsEnabled = false;

            var response = HandleRequest<UpdateClinicalInterestResponse>(handler, request);

            //assert
            using (var context = _objectContextFactory.CreateObjectContext())
            {
                clinicalInterest = context.CreateObjectSet<ClinicalInterest>().Single(g => g.Id == 1);
            }

            Assert.AreEqual(clinicalInterest.Name, "Update Test");
            Assert.AreEqual(clinicalInterest.IsEnabled, false);
        }
        public void update_ClinicalInterest_with_invalid_id()
        {
            //setup
            var handler = CreateHandler();
            var request = new UpdateClinicalInterestRequest();
            request.Id = 0;
            request.Name = "";
            request.IsEnabled = true;

            //act
            HandleRequest<UpdateClinicalInterestResponse>(handler, request);
        }
        private void Save()
        {
            _clinicalInterestsId = int.Parse(GetFieldValue(_viewModel.Fields, _id), CultureInfo.InvariantCulture);

            if (_clinicalInterestsId == 0)
            {
                var addRequest = new AddClinicalInterestRequest();

                var nameValue = GetFieldValue(_viewModel.Fields, _name);
                addRequest.Name = nameValue;
                var isEnabledValue = GetFieldValue(_viewModel.Fields, _isEnabled);
                addRequest.IsEnabled = bool.Parse(isEnabledValue);

                _clinicalInterestsId = ProcessRequest<AddClinicalInterestResponse>(addRequest).Id;
            }
            else
            {
                //Language Record
                if (_viewModel.Action == RecordActions.Edited)
                {
                    var updateRequest = new UpdateClinicalInterestRequest();

                    updateRequest.Id = _clinicalInterestsId;
                    var nameValue = GetFieldValue(_viewModel.Fields, _name);
                    updateRequest.Name = nameValue;
                    var isEnabledValue = GetFieldValue(_viewModel.Fields, _isEnabled);
                    updateRequest.IsEnabled = bool.Parse(isEnabledValue);

                    ProcessRequest<UpdateClinicalInterestResponse>(updateRequest);
                }
            }
        }