public ICollection<string> Create(InterviewContract interviewContract) { string [] result = new string [0]; IWorkbench workbench = new DefaultWorkbench(); InterviewBusinessObject interviewBusinessObject = new InterviewBusinessObject(workbench); Mapper.CreateMap<InterviewContract, InterviewBusiness>(); InterviewBusiness interviewBusiness = Mapper.Map<InterviewBusiness>(interviewContract); bool businessResult = interviewBusinessObject.Create(interviewBusiness); if (!businessResult) { int messageCount = interviewBusinessObject.Validator.CreatingValidator.ValidationMessages.Count; result = new string[messageCount]; for (int i = 0; i < messageCount; i ++) { ValidationMessage vm = interviewBusinessObject.Validator.CreatingValidator.ValidationMessages.ElementAt (i); result[i] = vm.ToString (); } } //InterviewCreatingWork return result; }
public void ReadAllTest() { IEnumerable<InterviewBusiness> interviewBusinessEnumerable = null; IInterviewBusinessObject interviewBusinessObject = new InterviewBusinessObject(workbench); interviewBusinessEnumerable = interviewBusinessObject.ReadAll(); }
public void ReadTest() { int id = 1; IInterviewBusinessObject interviewBusinessObject = new InterviewBusinessObject(workbench); InterviewBusiness interviewBusiness = interviewBusinessObject.Read(id); Assert.AreEqual (0, interviewBusinessObject.Validator.ReadingValidator.ValidationMessages.Count); }
public void UpdateTest() { int id = 1; IInterviewBusinessObject interviewBusinessObject = new InterviewBusinessObject(workbench); InterviewBusiness interviewBusiness = interviewBusinessObject.Read(id); interviewBusiness.Title = "Updated from Test"; interviewBusinessObject.Update(interviewBusiness); Assert.AreEqual(0, interviewBusinessObject.Validator.UpdatingValidator.ValidationMessages.Count); }
// GET: Interview public ActionResult Index() { Mapper.CreateMap<InterviewBusiness, InterviewViewModel>(); InterviewBusinessObject businessObject = new InterviewBusinessObject(_defaultWorkbench); IEnumerable<InterviewBusiness> list = businessObject.ReadAll(); List<InterviewViewModel> interviewViewModelList = Mapper.Map<List<InterviewViewModel>>(list); IEnumerator<InterviewViewModel> enumerator = interviewViewModelList.GetEnumerator(); return View(interviewViewModelList); }
public void CreateTest() { InterviewBusiness interviewBusiness = new InterviewBusiness { Title = "InterviewTitle", Position = "InterviewPosition", Date = DateTime.Now.AddDays (2), RequiredSkills = "InterviewRequiredSkills" }; IInterviewBusinessObject interviewBusinessObject = new InterviewBusinessObject(workbench); interviewBusinessObject.Create(interviewBusiness); Assert.AreEqual(0, interviewBusinessObject.Validator.CreatingValidator.ValidationMessages.Count); }