private void btnParseTrades_Click(object sender, EventArgs e)
        {
            var tradeValidator = new SimpleTradeValidator(logger);
            var tradeMapper    = new SimpleTradeMapper();
            var tradeParser    = new SimpleTradeParser(tradeValidator, tradeMapper);
            int numTrades      = tradeProcessor.ParseTrades(tradeParser, logger);

            txtNumTrades.Text = numTrades.ToString();
        }
        public void TestAmount101k()
        {
            //Arrange
            var logger         = new ConsoleLogger();
            var tradeValidator = new SimpleTradeValidator(logger);

            string[] strData = { "GBPUSD", "100001", "1.5" };
            //Act
            bool result = tradeValidator.Validate(strData);

            //Assert
            Assert.IsFalse(result);
        }
        public void TestNormalTrade()
        {
            //Arrange
            var logger         = new ConsoleLogger();
            var tradeValidator = new SimpleTradeValidator(logger);

            string[] strData = { "GBPUSD", "4444", "1.5" };
            //Act
            bool result = tradeValidator.Validate(strData);

            //Assert
            Assert.IsTrue(result);
        }
Esempio n. 4
0
        public void TestAmount100k()
        {
            //Arrange
            var logger         = new ConsoleLogger();
            var tradeValidator = new SimpleTradeValidator(logger);

            //string[] strData = { "GBPUSD", "1000000", "1.5" }; Wrong amount value here.
            string[] strData = { "GBPUSD", "100000", "1.5" };
            //Act
            bool result = tradeValidator.Validate(strData);

            //Assert
            Assert.IsTrue(result);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            var    tradeStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SingleResponsibilityPrinciple.trades.txt");
            String tradeUrl    = "http://faculty.css.edu/tgibbons/trades100.txt";

            var logger = new ConsoleLogger();
            //var logger = new GuiLogger(lbStatus.Items);

            //var tradeDataProvider = new StreamTradeDataProvider(tradeStream);
            var tradeDataProvider = new AdjustTradeDataProvider(tradeUrl); //changed to AdjustTradeDataProvider

            var tradeValidator = new SimpleTradeValidator(logger);
            var tradeMapper    = new SimpleTradeMapper();
            var tradeParser    = new SimpleTradeParser(tradeValidator, tradeMapper);

            var tradeStorage = new AdoNetTradeStorage(logger);

            tradeProcessor = new TradeProcessor(tradeDataProvider, tradeParser, tradeStorage);
        }