예제 #1
0
        public async Task Validation_Fail_Model_Visitor_VisitorController()
        {
            var model = new CreateVisitorModel();

            SimulateValidation(model);
            var result = (ViewResult)await visitorController.Create(model);

            Assert.IsNotNull(result);

            var viewData = result.ViewData;
            var viewBag  = result.ViewBag;

            Assert.AreEqual(3, viewData.Values.Count);
            Assert.AreEqual(3, ((SelectList)viewBag.Genders).Count());
            Assert.AreEqual(4, ((SelectList)viewBag.CheckPoints).Count());
            Assert.AreEqual(5, ((SelectList)viewBag.Nationalities).Count());
        }
예제 #2
0
        private async Task <GroupVisitorDTO> CreateGroup(CreateVisitorModel group, InfoVisitorModel visitor)
        {
            await accountController.SetInitDataAsync();

            group.Info = visitor;
            var result = (await visitorController.Create(group)) as RedirectToRouteResult;

            if (result == null)
            {
                return(null);
            }

            var groupResult = groupService.GetAll().LastOrDefault();

            return(groupResult);
        }