c# - Rhino Mocks expectation not returning collection correctly -


I'm new to Rhino Mox, and I'm usually using a fake isolation framework for unique testing. I have written the following test, where I have set an expectation for the duplicate IDataProvider object to return the collection of the object.

When I run the trial, call to the IDataProvider gives an empty list when it should return the list with an object.

Any thoughts are going wrong?

This is my test: (Please excuse any bad habit here ... do not hesitate to mention any of the above.) I am trying to learn! Thanks)

  [TestMethod ()] Public Nine FetchDataSeries_NeedsUpdate_SuccessfulDataSeriesRetrievedFromDataProvider () {List & lt; IDataSeries & gt; DataSeries = New List & lt; IDataSeries & gt; (); DataSeries.Add (New DataSeries ("Test")); Drilldown Level Level = Drilldown Level YEAR; Int? Year = 2008; Var Detector = _MockRepository.CreateMock & lt; IDataProvider & gt; (); DataProvider.Expect (DP = & gt; dp.GetDataSeries (string.opt, level, year, blank, empty, blank)). Return (datashear); _DataSourceContext.DataProvider = Detector; ArchiveArt Eracle (Datashell, _DataSourceContext.FetchDataSeries (level, year, null, null, void)); DataProvider.VerifyAllExpectations (); }  

The relevant part of the method under test: (DataProvider.GetDataSeries calls an empty list ... This should return the stubbed list.)

  Public override list & lt; IDataSeries & gt; FetchDataSeries (DrillDownLevel? DrillDownLevel, int? Year, int? Month, date time, day of the week, day) {list & lt; IDataSeries & gt; DataSeries = New List & lt; IDataSeries & gt; (); // Cash data for maximum cache period // if the data maxim has been cached for longer than the cache period or the update interval has expired. The use of the last update was lower than the minimum update interval (if needed, as updated (last exception, last exception)) Attempt to receive new data logging service. Infobarform ("Data source contact: {0}: trying to get new data:", name); DataSeries = DataProvider.GetDataSeries (DataQuery, drillDownLevel, Year, Month, Week, Day); } Return data series; }  

You want to play again:

  _MockRepository.ReplayAll (); ArchiveArt Eracle (Datashell, _DataSourceContext.FetchDataSeries (level, year, null, null, void));  

View:


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -