Exemplo n.º 1
0
        public void Details()
        {
            // Arrange
            JobController controller = new JobController();

            // Act
            ViewResult result = controller.Details(1045) as ViewResult;

            // Assert
            Assert.AreEqual("Your Job Detail Page", controller.ViewBag.Message);
        }
Exemplo n.º 2
0
        public void CallGetJobById_WithExpectedParsedId(int?id)
        {
            // Arrange
            var mappingService = new Mock <IMappingService>();
            var jobService     = new Mock <IJobService>();
            var userService    = new Mock <IUserService>();
            var jobController  = new JobController(mappingService.Object, jobService.Object, userService.Object);

            var jobId = (int)id;

            // Act
            jobController.Details(id);

            // Assert
            jobService.Verify(j => j.GetJobById(jobId), Times.Once);
        }
Exemplo n.º 3
0
        public void CallMapOnMappingServiceOnceWithExpectedJob()
        {
            // Arrange
            var mappingService = new Mock <IMappingService>();
            var jobService     = new Mock <IJobService>();
            var userService    = new Mock <IUserService>();
            var jobController  = new JobController(mappingService.Object, jobService.Object, userService.Object);

            int?jobId = 10;

            var job = new Job();

            jobService.Setup(j => j.GetJobById(It.IsAny <int>())).Returns(job);

            // Act
            jobController.Details(jobId);

            // Assert
            mappingService.Verify(m => m.Map <JobViewModel>(job), Times.Once);
        }