private async Task Salvar() { using (OperacaoRepository repository = new OperacaoRepository()) { await repository.Salvar(new Operacao( txtNome.Text) { Descricao = txtDescricao.Text, IdOperacao = operacao.IdOperacao, IsAtivo = chkAtivo.Checked }); DialogResult = DialogResult.OK; } }
public void When_ANewOperacaoIsAdded_Expect_ToBeFoundOnTheDatabase() { Operacao aNewOperacao = null; ExecuteSessionTransactionScope(session => { aNewOperacao = new Operacao(1, new DateTime(2020, 6, 17, 10, 33, 45), OperacaoTipo.Compra, "VIVT4", 100, 49.70d, 9999); new OperacaoRepository(session).Add(aNewOperacao); }); Operacao foundOnTheDatabase = null; ExecuteSessionTransactionScope(session => { foundOnTheDatabase = new OperacaoRepository(session).FindById(aNewOperacao.Id); }); Assert.True(aNewOperacao.PublicInstancePropertiesEqual(foundOnTheDatabase)); }
private async Task <List <Operacao> > SelecionarTodasOperacoes() { using (OperacaoRepository repository = new OperacaoRepository()) return(await repository.SelecionarTodos(false)); }