Exemple #1
0
        public void create_get_returns_employer()
        {
            //Arrange
            //Act
            var result = (PartialViewResult)ctrlr.Create();

            //Assert
            Assert.IsInstanceOfType(result.ViewData.Model, typeof(Web.ViewModel.Employer));
        }
Exemple #2
0
        public async Task create_get_returns_employer()
        {
            //Arrange

            //Act
            var result = await _controller.Create() as PartialViewResult;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.ViewData.Model, typeof(Machete.Web.ViewModel.Employer));
        }
Exemple #3
0
        public void create_post_invalid_throws_exception()
        {
            //Arrange
            var employer = new Domain.Employer();

            form.Remove("name");

            serv = new Mock <IEmployerService>();
            serv.Setup(p => p.Create(employer, "UnitTest")).Returns(employer);
            woServ = new Mock <IWorkOrderService>();
            ctrlr  = new EmployerController(serv.Object, def.Object, map);
            ctrlr.SetFakeControllerContext();
            ctrlr.ValueProvider = form.ToValueProvider();
            JsonResult result = ctrlr.Create(employer, "UnitTest");

            Assert.IsNotNull(result);
        }
Exemple #4
0
        public async Task employer_create_post_invalid_throws_exception()
        {
            //Arrange
            var employer = new Employer {
                ID = testId, name = string.Empty
            };

            _serv.Setup(p => p.Create(employer, "UnitTest")).Returns(employer);
            _controller = new EmployerController(_serv.Object, _defaults.Object, map, _adaptor.Object);
            _controller.ModelState.AddModelError("name", "Required");

            //Act
            var result = await _controller.Create(employer, "UnitTest");

            //Assert
            Assert.IsNotNull(result);
        }