public void PostFreelancer_Failure_CreateFreelancerFailed() { var service = new Mock <IFreelancerService>(); service.Setup(S => S.CreateFreelancer(It.IsAny <FreelancerCreate>())).Returns(false); var controller = new FreelancerController(service.Object); var model = new FreelancerCreate(); var result = controller.Post(model); Assert.IsInstanceOfType(result, typeof(InternalServerErrorResult)); }
public void PostFreelancer_Success() { var service = new Mock <IFreelancerService>(); service.Setup(S => S.CreateFreelancer(It.IsAny <FreelancerCreate>())).Returns(true); var controller = new FreelancerController(service.Object); var model = new FreelancerCreate(); var result = controller.Post(model); Assert.IsInstanceOfType(result, typeof(OkResult)); }