コード例 #1
0
        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;
        }
コード例 #2
0
        public void ReadAllTest()
        {
            IEnumerable<InterviewBusiness> interviewBusinessEnumerable = null;

            IInterviewBusinessObject interviewBusinessObject = new InterviewBusinessObject(workbench);
            interviewBusinessEnumerable = interviewBusinessObject.ReadAll();
        }
コード例 #3
0
        public void ReadTest()
        {
            int id = 1;

            IInterviewBusinessObject interviewBusinessObject = new InterviewBusinessObject(workbench);

            InterviewBusiness interviewBusiness = interviewBusinessObject.Read(id);

            Assert.AreEqual (0, interviewBusinessObject.Validator.ReadingValidator.ValidationMessages.Count);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        // 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);
        }
コード例 #6
0
        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);
        }