コード例 #1
0
        public void CallAttachJobToUserWithProvidedParameters(string userId, int jobId)
        {
            // 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);

            jobController.GetLoggedUserId = () => userId;

            // Act
            jobController.Buy(jobId);

            // Assert
            userService.Verify(u => u.AttachJobToUser(userId, jobId), Times.Once);
        }