Exemplo n.º 1
0
        public void ParseStockResponse()
        {
            var sut      = new StockParser();
            var response = "Symbol,Date,Time,Open,High,Low,Close,Volume\r\nAAPL.US,2019 - 08 - 16,22:00:01,204.28,207.16,203.84,206.5,28813624\r\n";
            var stock    = sut.Parse(response);

            Assert.AreEqual("AAPL.US", stock.Symbol);
            Assert.AreEqual("206.5", stock.Close);
        }
Exemplo n.º 2
0
        private void btnOpenFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                DataTableStocks      = ParseCVSFile.ConvertCSVtoDataTable(openFileDialog.FileName);
                addStockPopup.IsOpen = false;
                LoadData(DataTableStocks);
                UpdateChart(StockParser.GetChartDataGeared(DataTableStocks));
                //var data = ParseCVSFile.UploadReadFile(openFileDialog.FileName);
                //DataTableStocks.Rows.Add(data.Values);
                //UpdateDataTable(data);
            }

            //txtEditor.Text = File.ReadAllText(openFileDialog.FileName);
        }
        public void ParseTest()
        {
            var reader = new StringReader(@"# Material inventory initial state as of Jan 01 2018
# New materials
Cherry Hardwood Arched Door - PS;COM-100001;WH-A,5|WH-B,10
Maple Dovetail Drawerbox;COM-124047;WH-A,15
Generic Wire Pull;COM-123906c;WH-A,10|WH-B,6|WH-C,2
Yankee Hardware 110 Deg. Hinge;COM-123908;WH-A,10|WH-B,11
# Existing materials, restocked
Hdw Accuride CB0115-CASSRC - Locking Handle Kit - Black;CB0115-CASSRC;WH-C,10|WH-B,5|WH-C,3
Veneer - Charter Industries - 3M Adhesive Backed - Cherry 10mm - Paper Back;3M-Cherry-10mm;WH-A,10|WH-B,1
Veneer - Cherry Rotary 1 FSC;COM-123823;WH-C,10
MDF, CARB2, 1 1/8"";COM-101734;WH-C,8");

            using (var pres = new StockParser(new InputProvider(reader, new LineValidator())))
            {
                var result = pres.Parse();
                Assert.IsTrue(result.Count == 3);
                Assert.IsTrue(result.First(x => x.Name == "WH-C").TotalQuantity == 33);
            }
        }
Exemplo n.º 4
0
 public TestClass(StockParser parser)
 {
     testList = parser.Parse(new System.IO.StreamReader("Nordea.csv"));
     testList = new ObservableCollection <DataClass>(testList.Reverse());
     i        = 0;
 }
Exemplo n.º 5
0
 public TestClass(StockParser parser)
 {
     testList = parser.Parse(new System.IO.StreamReader("Nordea.csv"));
     testList = new ObservableCollection<DataClass>(testList.Reverse());
     i = 0;
 }