public async Task ShouldThrowExceptionIfCustomerIsNull()
        {
            Applicant applicant = null;

            var exception = await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => applicantService.CreateApplicant(applicant));

            Assert.IsNotNull(exception);
            Assert.AreEqual("applicant", exception.ParamName);
        }
        public async void CreateApplicantTest()
        {
            var result = await _applicantService.CreateApplicant(new December2020.Domain.Applicant.Models.CreateApplicantRequest
            {
                Name    = "testCreate",
                Address = "testCreateAddress"
            });

            Assert.NotNull(result);
            var findResult = this._context.Applicants.SingleOrDefault(x => x.Name == "testCreate");

            Assert.NotNull(findResult);
        }
Esempio n. 3
0
        protected async Task HandleValidSubmit()
        {
            Applicant result = null;

            if (Applicant.ID != 0)
            {
                result = await ApplicantService.UpdateApplicant(Applicant);
            }
            else
            {
                result = await ApplicantService.CreateApplicant(Applicant);
            }
            if (result != null)
            {
                NavigationManager.NavigateTo("/");
            }
        }
Esempio n. 4
0
        public async Task <ActionResult> SaveApplicant(ApplicantFormModel applicant)
        {
            var data = Mapper.Map <ApplicantFormModel, Applicant>(applicant);
            OperationDetails result;

            // Create or Edit applicant
            if (data.ApplicantId == 0)
            {
                result = await ApplicantService.CreateApplicant(data);

                return(result.Successed ?
                       Json(new { model = "confirmed", modelList = result.Message, applicantId = result.Property }, JsonRequestBehavior.AllowGet) :
                       Json(new { model = "failed", modelList = result.Message }, JsonRequestBehavior.AllowGet));
            }

            result = await ApplicantService.EditApplicant(data);

            return(Json(new { model = result.Successed ? "confirmed" : "failed", modelList = result.Message, type = "save" }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public async Task ShouldSaveApplicantInformation()
        {
            var applicant = new Applicant
            {
                Address         = "Address",
                Age             = 20,
                CountryOfOrigin = "NGN",
                EMailAddress    = "*****@*****.**",
                FamilyName      = "James",
                Hired           = true,
                ID   = _ID,
                Name = "Peter"
            };

            var applicantResult = await applicantService.CreateApplicant(applicant);

            Assert.IsNotNull(applicantResult);
            Assert.AreEqual(ResultCode.SUCCESS, applicantResult.ResponseCode);
            Assert.AreEqual(_ID, applicantResult.Result.ID);
        }
Esempio n. 6
0
        protected async Task SendValid()
        {
            var result = await ApplicantService.CreateApplicant(Applicant);
            //if (result != null)

        }