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 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); }