public void VendaRepository_Delete_ShouldBeOk() { Venda venda = ObjectMotherVenda.getValidVenda(); venda.Id = 1; _repository.Delete(venda); Venda deleteObject = _repository.Get(1); deleteObject.Should().BeNull(); }
public void Delete(int id) { VendaRepository vendaRepository; VendaModel venda; try { if (id == 0) { throw new Exception("ID inválido"); } else { vendaRepository = new VendaRepository(_loggerFactory, _config); venda = Get(id); if (vendaRepository != null) { vendaRepository.Delete(id); } } } catch (Exception ex) { throw ex; } }
public void Delete_Deveria_Deletar_Uma_Venda() { //Arrange Venda resultVenda = _vendaRepository.Save(_vendaDefault); //Action _vendaRepository.Delete(resultVenda); //Assert Venda resultGet = _vendaRepository.Get(resultVenda.Id); IList <Venda> resultGetAll = _vendaRepository.GetAll(); resultGet.Should().BeNull(); resultGetAll.Should().HaveCount(1); }