Hello,
I am currently running into an issue where the arrange method returns the wrong value for the mock. This does not occur all the time, but randomly, which seems to suggest a threading issue. The "arrange" code that I have is as follow:
However, sometimes I get the following error message:
System.InvalidCastException: Unable to cast object of type 'System.TimeSpan' to type 'FMFuelDispatch.Util.ObservableDictionary`2[System.String,FMFuelDispatch.Model.FuelBay]'.
According to the stack trace, it looks like there is something wrong with the proxy:
IRTObjectModel_Proxy_26c2fd2954ac4f68ba71390f3a22fa84._get_FuelBays(MethodInvocation , Int32 , Boolean )
IRTObjectModel_Proxy_26c2fd2954ac4f68ba71390f3a22fa84.get_FuelBays()
FMFuelDispatch.ViewModel.FuelScheduleViewModel.DataBindFuelSources(IRTObjectModel objModel, IDictionary`2 keyedResources, ResourceCollection resourceCollection)
Based on the above, it looks like that calling the FuelBays property of my mock, returns the first arrange. I am currently using the free edition of JustMock (v2011.3.1116.2). Is there anything I can do to work around this problem?
Thanks.
-Carlos.
I am currently running into an issue where the arrange method returns the wrong value for the mock. This does not occur all the time, but randomly, which seems to suggest a threading issue. The "arrange" code that I have is as follow:
IRTObjectModel model = Mock.Create<IRTObjectModel>(); Mock.Arrange<TimeSpan>(() => model.ShiftDateStartTime) .Returns(shiftDateStartTime); Mock.Arrange<IDictionary<string, FuelBay>>(() => model.FuelBays) .Returns(initialTestData.ActiveFuelBays); Mock.Arrange<IDictionary<string, FuelTruck>>(() => model.FuelTrucks) .Returns(initialTestData.ActiveFuelTrucks);
However, sometimes I get the following error message:
System.InvalidCastException: Unable to cast object of type 'System.TimeSpan' to type 'FMFuelDispatch.Util.ObservableDictionary`2[System.String,FMFuelDispatch.Model.FuelBay]'.
According to the stack trace, it looks like there is something wrong with the proxy:
IRTObjectModel_Proxy_26c2fd2954ac4f68ba71390f3a22fa84._get_FuelBays(MethodInvocation , Int32 , Boolean )
IRTObjectModel_Proxy_26c2fd2954ac4f68ba71390f3a22fa84.get_FuelBays()
FMFuelDispatch.ViewModel.FuelScheduleViewModel.DataBindFuelSources(IRTObjectModel objModel, IDictionary`2 keyedResources, ResourceCollection resourceCollection)
Based on the above, it looks like that calling the FuelBays property of my mock, returns the first arrange. I am currently using the free edition of JustMock (v2011.3.1116.2). Is there anything I can do to work around this problem?
Thanks.
-Carlos.