public void CheckControllerReturnsViewNameTest()
        {
            JobsController controller = new JobsController();
            ViewResult     result     = controller.Create() as ViewResult;

            Assert.IsNotNull(result);
        }
        public async Task CanSaveValidChanges()
        {
            //Arrange
            var            mock       = new Mock <IJobRepository>();
            JobsController controller = new JobsController(mock.Object, _mapper);

            var job = new JobRequest {
                Title = "Test", Description = "Test"
            };

            //Act
            var actionResult = await controller.Create(job);

            //Assert
            mock.Verify(m => m.SaveAsync(It.IsAny <Job>()));
        }
        public async Task CanNotSaveInvalidChanges()
        {
            //Arrange
            var            mock       = new Mock <IJobRepository>();
            JobsController controller = new JobsController(mock.Object, _mapper);

            // see, without Description field, just only Title ...
            var job = new JobRequest {
                Title = "Test"
            };

            //Act
            var actionResult = await controller.Create(job);

            //Assert
            mock.Verify(m => m.SaveAsync(It.IsAny <Job>()));
        }
        public void JobsController_CreatePost()
        {
            //arrange
            JobViewModel _model = new JobViewModel()
            {
                Id            = 1,
                JobTitle      = "title",
                JobDecription = "description",
                JobType       = "Fencing",
                Latitude      = 2.21287821,
                Longitude     = 1.111111
            };
            JobsController controller = new JobsController(new FakeJobRepository());

            //act
            System.Web.Mvc.RedirectToRouteResult result = controller.Create(_model) as System.Web.Mvc.RedirectToRouteResult;

            //assert
            Assert.IsNotNull(result);
        }