Beispiel #1
0
        public void Put()
        {
            this.InstanciarRequest(HttpMethod.Put);
            var result = _itemValorAPI.Put(ItemSubValorStub.ItemSubValor());

            Assert.IsTrue(result.IsSuccessStatusCode);
        }
        public void Salva_valor()
        {
            var itemSubValor = ItemSubValorStub.NovoItemSubValor();

            repository.Save();

            Assert.AreEqual(itemSubValor.Valor, 78.5M);
        }
        public void Edita_valor()
        {
            var itemSubValor = ItemSubValorStub.ItemSubValor();

            repository.Edit(itemSubValor);

            Assert.AreEqual(itemSubValor.Valor, 51);
        }
        public void Inicializa()
        {
            var repositoryMock = new Mock <IItemSubValorRepository>();

            repositoryMock.Setup(x => x.GetAll()).Returns(ItemSubValorStub.ItemSubValores());
            repositoryMock.Setup(x => x.GetByValor(It.IsAny <Int32>())).Returns(ItemSubValorStub.ItemSubValores());
            repositoryMock.Setup(x => x.FindById(It.IsAny <Int32>())).Returns(ItemSubValorStub.ItemSubValor());
            repositoryMock.Setup(x => x.Add(It.IsAny <ItemSubValor>())).Returns(ItemSubValorStub.NovoItemSubValor());
            repositoryMock.Setup(x => x.Delete(It.IsAny <ItemSubValor>())).Returns(ItemSubValorStub.ItemSubValor());
            repositoryMock.Setup(x => x.Edit(It.IsAny <ItemSubValor>()));
            repositoryMock.Setup(x => x.Save());

            repository = repositoryMock.Object;
        }
        public void Exclui_valor()
        {
            var itemValor = repository.Delete(ItemSubValorStub.ItemSubValor());

            Assert.AreEqual(itemValor.Valor, 51);
        }
        public void Adiciona_valor()
        {
            var itemValor = repository.Add(ItemSubValorStub.NovoItemSubValor());

            Assert.IsTrue(itemValor.Valor >= 0);
        }
 public void Excluir()
 {
     _itemSubValorServiceMock.Setup(x => x.Delete(It.IsAny <ItemSubValor>()));
     _itemSubValorServiceMock.Setup(x => x.Save());
     _gerenciadorDeItemSubValor.Excluir(ItemSubValorStub.ItemSubValor());
 }
 public void Editar()
 {
     _itemSubValorServiceMock.Setup(x => x.Edit(It.IsAny <ItemSubValor>()));
     _itemSubValorServiceMock.Setup(x => x.Save());
     Assert.IsNotNull(_gerenciadorDeItemSubValor.Editar(ItemSubValorStub.ItemSubValor()));
 }
 public void Salvar()
 {
     _itemSubValorServiceMock.Setup(x => x.Add(It.IsAny <ItemSubValor>())).Returns(ItemSubValorStub.NovoItemSubValor());
     _itemSubValorServiceMock.Setup(x => x.Save());
     Assert.IsTrue(_gerenciadorDeItemSubValor.Salvar(It.IsAny <ItemSubValor>()));
 }
 public void Inicializa()
 {
     itemSubValor = ItemSubValorStub.NovoItemSubValor();
 }
        public void Enviar_Edit()
        {
            _itemSubValor = new ItemSubValorController(_gerenciadorDeItemSubValor, _gerenciadorDeItemValor);
            var itemSubValorViewModel = Mapeador.Mapear <ItemSubValor, ItemSubValorViewModel>(ItemSubValorStub.ItemSubValor());
            var result = _itemSubValor.Edit(1, itemSubValorViewModel) as RedirectToRouteResult;

            Assert.AreEqual("Index", result.RouteValues["action"]);
        }