private void Remove(List <string> args) { if (args.Count == 0) { _console.WriteError("Неверное число аргументов"); return; } foreach (var ticker in args) { _tickSource.RemoveInstrum(ticker); } View(); }
public void SaveGet_update_getChanged() { IInstrumBL instrumBL = new InstrumBLMock(); ITickSourceDA tickSourceDA = new TickSourceDAMock(); TickSourceBL tickSourceBL = new TickSourceBL(instrumBL, tickSourceDA, null, null); var ts0 = new TickSource(instrumBL, null, null); ts0.Name = "наименование"; ts0.StartDate = new DateTime(2010, 1, 1); ts0.EndDate = new DateTime(2010, 12, 31); ts0.Timeframe = Timeframes.Hour; ts0.AddInstrum(1); ts0.AddInstrum(2); ts0.AddInstrum(3); tickSourceBL.SaveTickSource(ts0); // insert int id = ts0.TickSourceID; ts0.Name = "новое наименование"; ts0.StartDate = new DateTime(2011, 1, 1); ts0.EndDate = new DateTime(2011, 12, 31); ts0.Timeframe = Timeframes.Min10; ts0.AddInstrum(4); ts0.RemoveInstrum(1); tickSourceBL.SaveTickSource(ts0); // update var ts = tickSourceBL.GetTickSourceByID(id); Assert.Equal(id, ts.TickSourceID); Assert.Equal(ts0.Name, ts.Name); Assert.Equal(ts0.StartDate, ts.StartDate); Assert.Equal(ts0.EndDate, ts.EndDate); Assert.Equal(ts0.Timeframe, ts.Timeframe); string ids0 = string.Join(',', ts0.GetInstrums().Select(r => r.InsID.ToString()).OrderBy(r => r)); string ids = string.Join(',', ts.GetInstrums().Select(r => r.InsID.ToString()).OrderBy(r => r)); Assert.Equal(ids0, ids); }