示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public UpdateUserShould()
 {
     _svc        = new Mock <IUserService>();
     _controller = UserControllerFactory.Create(_svc.Object);
 }