Exemplo n.º 1
0
        public void GetServant_ShouldReturnServant_WhenServantIsFoundInRepository()
        {
            var id = 1;

            MockRepo.Setup(repo => repo.GetServantById(id)).Returns <int>(m => new Servant());

            var controller = new ServantController(MockRepo.Object, MockServantCreationValidator.Object);

            Assert.IsInstanceOf <Servant>(controller.GetServantById(id));
        }
Exemplo n.º 2
0
        public void GetServantById_ShouldReturnNoContentResult_WhenServantIsNull()
        {
            var id = 1;

            MockRepo.Setup(repo => repo.GetServantById(id)).Returns <int>(sId => null);

            var controller = new ServantController(MockRepo.Object, MockServantCreationValidator.Object);

            Assert.IsInstanceOf <NoContentResult>(controller.GetServantById(id));
        }