public void SucessoCentavos(decimal valorDivida, decimal valorEntregue) { MoedaService service = this.CreateService(); var baseMoeda = new Mock <IBaseRepository <Moeda, MoedaDTO> >(); mockUnitOfWork .Setup(c => c.MoedaRepository) .Returns(baseMoeda.Object); mockUnitOfWork .Setup(c => c.MoedaRepository.GetAll()) .Returns(GetMoedas()); var result = service.ObterTroco(valorDivida, valorEntregue).Result; List <MoedaDTO> resultadoEsperado = new List <MoedaDTO>(); resultadoEsperado.Add(new MoedaDTO { Valor = 1, NotasRetornadas = 4 }); resultadoEsperado.Add(new MoedaDTO { Valor = (decimal)0.05, NotasRetornadas = 1 }); Assert.True(result.Status); CompareIEnumerable(resultadoEsperado, result.MoedasRetorno, (x, y) => x.Valor == y.Valor && x.NotasRetornadas == y.NotasRetornadas); }
public MoedaDetalheViewModel() { int id = Global.MoedaDetalhe.IdMoeda; Moeda = new MoedaService().GetById(id); // Criando o Grafico Grafico = GerarGraficoPizza(); }
static void NovaThread() { var str = Moedas.Dequeue(); MoedaService.CriarMoedaCotacao(str); Console.WriteLine("\nMoeda: " + str.moeda + "\nData Inicio: " + str.data_inicio + "\nData Fim: " + str.data_fim); Thread.Sleep(100); stopWatch.Stop(); Console.WriteLine("\nTempo de Ciclo: " + stopWatch.Elapsed); }
public static MvcHtmlString SelectMoeda(this HtmlHelper html, int idMoeda = 0, bool selecione = false, string idTag = "IdMoeda") { var idEmpresa = new UsuarioService().GetUsuario(System.Web.HttpContext.Current.User.Identity.Name).IdEmpresa; var moedas = new MoedaService().Listar() .Where(x => x.IdEmpresa == idEmpresa) .OrderBy(x => x.Descricao) .ToList(); TagBuilder tag = new TagBuilder("select"); tag.MergeAttribute("id", idTag); tag.MergeAttribute("name", idTag); tag.MergeAttribute("class", "form-control"); tag.MergeAttribute("style", "width:80px;"); if (selecione == true) { TagBuilder itemSel = new TagBuilder("option"); itemSel.MergeAttribute("value", "0"); itemSel.SetInnerText(""); tag.InnerHtml += itemSel.ToString(); } foreach (var item in moedas) { TagBuilder itemTag = new TagBuilder("option"); itemTag.MergeAttribute("value", item.Id.ToString()); if (idMoeda != 0) { if (item.Id == idMoeda) { itemTag.MergeAttribute("selected", "selected"); } } else { if (item.Padrao == true) { itemTag.MergeAttribute("selected", "selected"); } } itemTag.SetInnerText(item.Descricao); tag.InnerHtml += itemTag.ToString(); } return(new MvcHtmlString(tag.ToString())); }
public void ErroaoValorMenor() { var valorDivida = (decimal)10; var valorEntregue = (decimal)10000; MoedaService service = this.CreateService(); var userStore = new Mock <IBaseRepository <Moeda, MoedaDTO> >(); var t = new Mock <CoreContext>(); mockUnitOfWork .Setup(c => c.MoedaRepository) .Returns(userStore.Object); var result = service.ObterTroco(valorDivida, valorEntregue).Result; Assert.False(result.Status); Assert.Equal("Não há notas disponíveis para realizar este saque.", result.Mensagem); }
public void ErroNaoHaNotas() { var valorDivida = (decimal)10; var valorEntregue = (decimal)1; MoedaService service = this.CreateService(); var userStore = new Mock <IBaseRepository <Moeda, MoedaDTO> >(); var t = new Mock <CoreContext>(); mockUnitOfWork .Setup(c => c.MoedaRepository) .Returns(userStore.Object); var result = service.ObterTroco(valorDivida, valorEntregue).Result; Assert.False(result.Status); Assert.Equal("Valor recebido insuficiente", result.Mensagem); }
public MoedaViewModel() { moedasSelecionadas = new List <MoedaModel>(); ListaMoedas = new MoedaService().Get(); //Filtro de moedas -> Filtro de filmes //No exemplo de Filmes, serão exibidos 10 filmes //Aqui eu exibo somente 2 moedas filtrarMaximoMoedas(); EntrarClickedCommand = new Command(() => { try { //if(moedasSelecionadas.Count == 3) //{ MessagingCenter.Send(ListaMoedas, "MoedasSelecionadasPageAbrir"); //} } catch (Exception ex) { Console.WriteLine(ex); } }); }
public IEnumerable <Moeda> Listar() { return(MoedaService.Listar()); }
public Moeda(string sigla) { atualizarPropriedades(MoedaService.ObterMoeda(sigla)); }
public Moeda(int codigo) { atualizarPropriedades(MoedaService.ObterMoeda(codigo)); }