public void PersistenceTest() { IPersistence persister = new Persistence(); List <IBar> bars = BarMocks.UpMove(1000, (double)100); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var bar in bars) { bar.BarId = 0; bar.Period = 100; Felix.Models.BarCreationRequest request = new Felix.Models.BarCreationRequest("YMH18", bar); persister.PersistBar(request); } stopwatch.Stop(); Debug.WriteLine($"adding {bars.Count} bars took {stopwatch.ElapsedMilliseconds}"); persister.Stop(); //DateTime later = DateTime.Now; //Debug.WriteLine($"{bars.Count} bars took {later-now}"); }
public void ClientTest() { IBar bar = BarMocks.UpMove(1, (double)100).ToList().First(); Felix.Models.BarCreationRequest request = new Felix.Models.BarCreationRequest("YMH18", bar); IFelixHttpClient client = new FelixHttpClient(); int barId = client.CreateBar(request).Result; Assert.IsTrue(barId > 0); }
public async Task PersistAsyncTest() { var t = Task.Run(() => { try { List <IBar> bars = BarMocks.UpMove(1, (double)100); DateTime now = DateTime.Now; Felix.Models.BarCreationRequest request = new Felix.Models.BarCreationRequest("YMH18", bars.First()); persister.PersistBarAsTask(request); } catch (Exception e) { Debug.WriteLine($"{e.Message}"); Debugger.Break(); } }); await t; }