public void ReturnOk() { //Given _svc.Setup(s => s.GetUser(It.IsAny <int>())).Returns(UserFixtures.ValidUser()); var ctrl = UserControllerFactory.Create(_svc.Object); //When var ok = ctrl.GetUser(99); var a = (ok as OkObjectResult)?.Value; //Then Assert.IsType <OkObjectResult>(ok); Assert.IsType <UserDto>(a); }
public void ReturnAllUsers() { //Given var svc = new Mock <IUserService>(); svc.Setup(s => s.GetAllUsers()).Returns(UserFixtures.GetUsers()); var controller = UserControllerFactory.Create(svc.Object); //When var okResult = controller.GetUsers(); //Then Assert.IsType <OkObjectResult>(okResult); }
public UpdateUserShould() { _svc = new Mock <IUserService>(); _controller = UserControllerFactory.Create(_svc.Object); }