示例#1
0
        public CadastroIncotermTests()
        {
            _unitOfWorkMock = CommonMocks.DefaultUnitOfWorkMock();
            _incotermsMock  = new Mock <IIncoterms>(MockBehavior.Strict);
            _incotermsMock.Setup(x => x.Save(It.IsAny <Incoterm>())).Callback((Incoterm incoterm) => Assert.IsNotNull(incoterm));
            _incotermsMock.Setup(x => x.FiltraPorListaDeCodigos(It.IsAny <string[]>()))
            .Callback((string[] i) =>
            {
                _incotermRetornoRepositorio = (i.Contains("001")
                                                           ? new IncotermParaAtualizacao("001", "INCOTERM 001")
                                                           : null);
            })
            .Returns(_incotermsMock.Object);

            _incotermsMock.Setup(x => x.List())
            .Returns(() =>
            {
                var retorno = new List <Incoterm>();
                if (_incotermRetornoRepositorio != null)
                {
                    retorno.Add(_incotermRetornoRepositorio);
                }
                return(retorno);
            });

            _cadastroIncoterm = new CadastroIncoterm(_unitOfWorkMock.Object, _incotermsMock.Object);
            _incotermPadrao   = new IncotermCadastroVm()
            {
                Codigo    = "001",
                Descricao = "INCOTERM 001"
            };
            _listaIncoterms = new List <IncotermCadastroVm>()
            {
                _incotermPadrao
            };
        }
示例#2
0
 public IncotermApiController(ICadastroIncoterm cadastroIncoterm)
 {
     _cadastroIncoterm = cadastroIncoterm;
 }