Пример #1
0
 public AnunciosController(IAnuncioAppService _context,
                           IDomainNotificationHandler <DomainNotification> notifications,
                           ISuperDigitalClient _client) : base(notifications)
 {
     context = _context;
     client  = _client;
 }
Пример #2
0
        public void Deve_Retornar_Uma_Lista_De_Erros_Quando_So_Passar_A_Marca(string marca)
        {
            _anuncioAppService = _services.GetService <IAnuncioAppService>();
            AnuncioAdicionarRequest request = new AnuncioAdicionarRequest
            {
                Marca = marca,
            };

            _anuncioRepositoryMock.Setup(r => r.Adicionar(It.IsAny <Anuncio>())).Returns(_faker.Random.Number(1, 100));
            AnuncioAdicionarResponse response = _anuncioAppService.Adicionar(request);

            Assert.True(response.Id == 0);
            Assert.True(response.Erros.Any());
        }
Пример #3
0
        public void Deve_Retornar_Uma_Mensagem_Marca_Obrigatoria_Quando_Nao_Passar_A_Marca_No_Adicionar()
        {
            _anuncioAppService = _services.GetService <IAnuncioAppService>();
            AnuncioAdicionarRequest request = new AnuncioAdicionarRequest
            {
                Marca         = "",
                Modelo        = _faker.Vehicle.Model(),
                Versao        = _faker.Vehicle.Vin(),
                Ano           = _faker.Random.Number(4, 4),
                Quilometragem = _faker.Random.Number(1, 3),
            };

            AnuncioAdicionarResponse response = _anuncioAppService.Adicionar(request);

            Assert.Contains(response.Erros, x => x.Descricao == "Marca é obrigatório" && x.Codigo == 400);
        }
Пример #4
0
        public void Deve_Adicionar_Quando_Todos_Os_Campos_Estao_Preenchidos()
        {
            _anuncioAppService = _services.GetService <IAnuncioAppService>();
            AnuncioAdicionarRequest request = new AnuncioAdicionarRequest
            {
                Marca         = _faker.Vehicle.Type(),
                Modelo        = _faker.Vehicle.Model(),
                Versao        = _faker.Vehicle.Vin(),
                Ano           = _faker.Random.Number(2000, 2020),
                Quilometragem = _faker.Random.Number(100000),
            };

            _anuncioRepositoryMock.Setup(r => r.Adicionar(It.IsAny <Anuncio>())).Returns(_faker.Random.Number(1, 100));
            AnuncioAdicionarResponse response = _anuncioAppService.Adicionar(request);

            Assert.True(response.Id > 0);
            Assert.True(!response.Erros.Any());
        }
Пример #5
0
 public AnunciosController(IAnuncioAppService anuncioApp)
 {
     _anuncioApp = anuncioApp;
 }
Пример #6
0
 public AnunciosController(IAnuncioAppService _context,
                           IDomainNotificationHandler <DomainNotification> notifications,
                           IUser _user) : base(notifications, _user)
 {
     context = _context;
 }
 public AnuncioController(IAnuncioAppService anuncioAppService)
 {
     _anuncioAppService = anuncioAppService;
 }
Пример #8
0
 public AnunciosController(IAnuncioAppService service, IMapper mapper)
 {
     _service = service;
     _mapper  = mapper;
 }
 public AnunciosController(IAnuncioAppService anuncioApp, IClienteAppService clienteApp)
 {
     _anuncioApp = anuncioApp;
     _clienteApp = clienteApp;
 }
Пример #10
0
 public AnunciosController(IMapper mapper, IAnuncioAppService anuncioApp)
 {
     _mapper     = mapper;
     _anuncioApp = anuncioApp;
 }