public void CallApi(SharedData shared, CurrencyPair pair) { var pairData = new PairFactory().GetPairData(pair); shared.Log.AddLogEvent("JsonTradeFile Path:", pairData.TradeJsonPath); shared.Log.AddLogEvent("CsvTradeFile Path:", pairData.TradeCsvPath); if (shared.IsFirstRun) { shared.Since = GetLastTradeNumber(pairData.TradeJsonPath, shared); shared.Log.AddLogEvent("Last Trade Number: ", $"{shared.Since}\n"); shared.IsFirstRun = false; } var _url = pairData.TradeUrl + shared.Since; shared.Log.AddLogEvent("Api Call Path:", _url.ToString()); GetTrades(shared, pair, _url, pairData.TradeJsonPath, pairData.TradeCsvPath, out long _since); shared.Since = _since; shared.Log.AddLogEvent($"Run {++shared.Count} Finished\n\n"); shared.Log.PersistLog(); shared.Log.Log = string.Empty; }
public void OnEndPairEvent7() { var pf = new PairFactory(); Tuple <Pair, Interval, bool> t = null; pf.OnEndPair += (pair, interval, endedByEof) => { if (t == null) { t = new Tuple <Pair, Interval, bool>(pair, interval, endedByEof); } }; var code = @"el1: el2 == abc " ; var parser = new Parser(new InputStream(code), pf, new Module { Name = "Module" }); parser.ParseModule(""); Assert.IsNotNull(t); Assert.AreEqual("el2", t.Item1.Name); Assert.AreEqual(5, t.Item2.End.Line); Assert.AreEqual(2, t.Item2.End.Column); Assert.AreEqual(true, t.Item3); }
public void IndentEof() { var pf = new PairFactory(); var code = "line 1\n\t\t\n\t\t"; var parser = new Parser(new InputStream(code), pf, new Module("Module")); var module = parser.ParseModule(); Assert.AreEqual(0, module.IndentMultiplicity); Assert.AreEqual('\t', module.IndentSymbol); }
public void ValueIndent1() { var pf = new PairFactory(); const string code = @"el1: "; var parser = new Parser(new InputStream(code), pf, new Module("Module", "")); var m = parser.ParseModule(); var mp = (IMappedPair)m.ModuleDocument.Entities[0]; Assert.AreEqual(1, mp.ValueIndent); }
public void OnEndPairEvent6() { var pf = new PairFactory(); var ebf = false; pf.OnEndPair += (pair, interval, endedByEof) => { ebf = endedByEof; }; var code = @"el1"; var parser = new Parser(new InputStream(code), pf, new Module("Module")); parser.ParseModule(); Assert.AreEqual(true, ebf); }
public void OnEndPairEvent2() { var pf = new PairFactory(); var i = new List <int>(); pf.OnEndPair += (pair, interval, endedByEof) => { i.Add(interval.Begin.Column); }; var code = @"(1:(2=3)))"; var parser = new Parser(new InputStream(code), pf, new Module("Module")); parser.ParseModule(); Assert.AreEqual(4, i.Count); }
public void OnEndPairEvent11() { var pf = new PairFactory(); Tuple <Pair, Interval, bool> t = null; pf.OnEndPair += (pair, interval, endedByEof) => { t = new Tuple <Pair, Interval, bool>(pair, interval, endedByEof); }; var code = "el=text\r\n"; var parser = new Parser(new InputStream(code), pf, new Module("Module")); parser.ParseModule(); Assert.IsNotNull(t); Assert.AreEqual("el", t.Item1.Name); Assert.AreEqual(1, t.Item2.End.Line); Assert.AreEqual(7, t.Item2.End.Column); Assert.AreEqual(false, t.Item3); }
public void OnEndPairEvent8() { var pf = new PairFactory(); Tuple <Pair, Interval, bool> t = null; pf.OnEndPair += (pair, interval, endedByEof) => { if (t == null && endedByEof) { t = new Tuple <Pair, Interval, bool>(pair, interval, true); } }; var code = @"el1:el2 "; var parser = new Parser(new InputStream(code), pf, new Module("Module")); parser.ParseModule(); Assert.IsNull(t); }
public void OnEndPairEvent() { var pf = new PairFactory(); Interval endInterval = null; pf.OnEndPair += (pair, interval, endedByEof) => { if (endInterval == null) { endInterval = interval; } }; var code = @"el1:( )"; var parser = new Parser(new InputStream(code), pf, new Module("Module")); parser.ParseModule(); if (endInterval != null) { Assert.AreEqual(')', code[endInterval.End.Index]); } }