Пример #1
0
        public void ReturnOkWhenUserFound()
        {
            //Given
            _svc.Setup(s => s.Update(It.IsAny <User>(), It.IsAny <string>()))
            .Returns(UserFixtures.ValidUser());
            //When
            var rv = _controller.Update(UserFixtures.DtoUser());

            //Then
            Assert.IsType <OkObjectResult>(rv);
        }
Пример #2
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);
        }