private IPriceSeriesDataSource CreateDataSource(string dataSourceName, IEnumerable <SimplePrice> data, params IPriceSeriesOperator[] operators) { var realDataSource = Mockery.NewMock <IEnumerableDataSource <SimplePrice> >(); Mockery.Return(realDataSource.Name, dataSourceName); Mockery.Return(realDataSource.ForStock(null), data); return(new PriceSeriesDataSource(realDataSource, operators)); }
private CachingDataSourceFactory CreateFactory() { var realFactory = Mockery.NewMock <IDataSourceFactory>();; Mockery.Return(realFactory.CanCreate(null, null), true); NMock2.Stub.On(realFactory).Method("Create") .Will(new LambdaAction(inv => { inv.Result = Mockery.NewMock(inv.Parameters[1] as Type); })); return(new CachingDataSourceFactory(realFactory)); }