public void Setup() { var logger = new Mock <ILogger <ExampleService> >(); var mapper = AutoMapperFactory.GetMapper(); repository = new Mock <IExampleRepository>(); repository.Setup(r => r.Get()).Returns(ExampleMockResult.Get()); repository.Setup(r => r.Get(It.IsAny <long>())).Returns(ExampleMockResult.Get().First()); repository.Setup(r => r.Create(It.IsAny <List <ExampleModel> >())).Returns(1); repository.Setup(r => r.Modify(It.IsAny <ExampleModel>())).Returns(ExampleMockResult.Get().First()); repository.Setup(r => r.Delete(It.IsAny <long>())).Returns(1); service = new ExampleService(repository.Object, logger.Object, mapper); }
public void Setup() { var mapper = new Mock <IMapper>(); var logger = new Mock <ILogger <ExampleController> >(); service = new Mock <IExampleService>(); service.Setup(r => r.Get()).Returns(ExampleMockResult.Get()); service.Setup(r => r.Get(It.IsAny <long>())).Returns(ExampleMockResult.Get().First()); service.Setup(r => r.Create(It.IsAny <List <ExampleEntity> >())).Returns(1); service.Setup(r => r.Modify(It.IsAny <ExampleEntity>())).Returns(ExampleMockResult.Get().First()); service.Setup(r => r.Delete(It.IsAny <long>())).Returns(1); controller = new ExampleController(service.Object, logger.Object, mapper.Object); }
public void Setup() { var mapper = new Mock <IMapper>(); var logger = new Mock <ILogger <UsuarioController> >(); service = new Mock <IUsuarioServico>(); service.Setup(r => r.ObterTodos()).Returns(ExampleMockResult.Get()); service.Setup(r => r.ObterPorId(It.IsAny <long>(), It.IsAny <bool>())).Returns(ExampleMockResult.Get().First()); service.Setup(r => r.Cadastrar(It.IsAny <Usuario>())).Returns(ExampleMockResult.Get().First()); service.Setup(r => r.Alterar(It.IsAny <Usuario>())).Returns(ExampleMockResult.Get().First()); service.Setup(r => r.Excluir(It.IsAny <long>())).Returns(1); controller = new UsuarioController(service.Object, logger.Object, mapper.Object); }
public void Setup() { var logger = new Mock <ILogger <UsuarioServico> >(); var resource = new Mock <IResourceLocalizer>(); repository = new Mock <IUsuarioRepositorio>(); emailRepository = new Mock <IEmailRepositorio>(); validacaoRepository = new Mock <IValidacaoRepositorio>(); repository.Setup(r => r.ObterTodos()).Returns(ExampleMockResult.Get()); repository.Setup(r => r.ObterPorId(It.IsAny <long>(), It.IsAny <bool>())).Returns(ExampleMockResult.Get().First()); repository.Setup(r => r.Cadastrar(It.IsAny <Usuario>())).Returns(ExampleMockResult.Get().First()); repository.Setup(r => r.Alterar(It.IsAny <Usuario>())).Returns(ExampleMockResult.Get().First()); repository.Setup(r => r.Excluir(It.IsAny <long>())).Returns(1); service = new UsuarioServico(repository.Object, emailRepository.Object, validacaoRepository.Object, logger.Object, resource.Object); }