static void Main(string[] args) { IInstrument _instrument; //ピアノ生成 _instrument = _instrumentFactory.CreateInstrument(Instrument.InstrumentEnum.Piano); System.Console.WriteLine(_instrument.Play()); System.Console.WriteLine(_instrument.CanPortable() == true ? "持ち運べます。" : "持ち運べません!"); //フルート生成 _instrument = _instrumentFactory.CreateInstrument(Instrument.InstrumentEnum.Flute); System.Console.WriteLine(_instrument.Play()); System.Console.WriteLine(_instrument.CanPortable() == true ? "持ち運べます。" : "持ち運べません!"); System.Console.ReadLine(); }
public void CreateInstrumetTest_Create_SpreadImpliedNonlinearModel_Test() { var factory = new InstrumentFactory(); var instrumentState = Substitute.For <ITTInstrumentState>(); var def = new InstrDef("CME", "ZN", "FUTURE", "Dec15", "ZNZ5", "SpreadImpliedNonlinear"); Instrument instrument = factory.CreateInstrument(def, instrumentState); Assert.IsType <InstrumentFutureSpreadImplied>(instrument); }
public void CreateInstrumetTest_Create_FlowdownSpread_Test() { var factory = new InstrumentFactory(); var instrumentState = Substitute.For <ITTInstrumentState>(); var def = new InstrDef("CME", "ZN", "SPREAD", "CME Reduced Tick Spread: 1xZN Dec15:-1xMar16", "+ZNZ5-ZNH6", "FlowdownSpread"); Instrument instrument = factory.CreateInstrument(def, instrumentState); Assert.IsType <InstrumentSpreadFlowdown>(instrument); }
public void TryToCreateInstrument() { var instrumentFactory = new InstrumentFactory(); var instrument = instrumentFactory.CreateInstrument("TestGuitar"); Assert.That(instrument, Is.Not.Null, "Instrument wasn't created correctly!"); Assert.That(instrument, Is.TypeOf <TestGuitar>(), "Created instrument isn't of the correct type!"); }