예제 #1
0
        public void Setup()
        {
            configurationAccessor = Options.Create <Configuration>(new Configuration()
            {
                Currencies = new System.Collections.Generic.List <CurrencySetting>()
                {
                    new CurrencySetting {
                        ISO = "USD", ApiUrl = "http://www.bancoprovincia.com.ar/Principal/Dolar", FakeValue = 1, MaxSupported = 200
                    },
                    new CurrencySetting {
                        ISO = "BRL", ApiUrl = "", FakeValue = 1, MaxSupported = 300
                    }
                }
            });

            var options = new DbContextOptionsBuilder <CurrencyDBContext>().UseInMemoryDatabase("ServiceTest").Options;

            currencyDBContext = new CurrencyDBContext(options);

            currencyRepository        = new CurrencyRepository(currencyDBContext);
            rateTransactionRepository = new RateTransactionRepository(currencyDBContext);

            unitOfWork   = new UnitOfWork(currencyDBContext, currencyRepository, rateTransactionRepository);
            currencyRate = new CurrencyRate();
            request      = new Request();

            defaulController = new DefaultController(configurationAccessor, request, currencyRate, unitOfWork);
        }
예제 #2
0
 public CurrencyService(CurrencyDBContext dBContext, IMapper mapper, IAPIConsumer APIConsumer, ILogger <CurrencyService> logger)
 {
     _dBContext   = dBContext;
     _mapper      = mapper;
     _APIConsumer = APIConsumer;
     _logger      = logger;
 }
예제 #3
0
        public bool Insert(SuccessResponse response)
        {
            CurrencyDBContext context = new CurrencyDBContext();
            var DbOp = new DbOperations(context);
            var convertedResponse = convertResponseToDB(response);

            return(DbOp.InsertResponse(convertedResponse));
        }
예제 #4
0
 public HomeController(ILogger <HomeController> logger, CurrencyDBContext context, IMemoryCache memoryCache)
 {
     _logger          = logger;
     _context         = context;
     this.memoryCache = memoryCache;
 }
 public CurrencyParametersValidator(CurrencyDBContext currencyDBContext)
 {
     _dbContext = currencyDBContext;
     Rules();
 }