Exemplo n.º 1
0
        public void TradeParser_NegativeTradeAmount_ThrowsException()
        {
            var regexMock = SetupRegexMock("-1");

            var tradeParserService = new TradeParserService(regexMock.Object, _configMock.Object);

            Assert.Throws <ArgumentException>(() => tradeParserService.Parse("AUDEUR,-1,1.5"));
        }
Exemplo n.º 2
0
        public void TradeParser_LineParses_IntoTradeObject()
        {
            var regexMock = SetupRegexMock("1");

            var tradeParserService = new TradeParserService(regexMock.Object, _configMock.Object);

            var trade = tradeParserService.Parse("I <3 parsing");

            Assert.Equal("AUD", trade.SourceCurrency);
            Assert.Equal("EUR", trade.DestinationCurrency);
            Assert.Equal(1 / 10000f, trade.Lots);
            Assert.Equal((decimal)1.5, trade.Price);
        }