var mocks = new MockRepository();
var access = new Access();
access.ShowRepository = _mocks.Stub<IShowRepository>();
access.ShowRepository.Stub(x => x.GetShows()).Return(new List<Show>());
var kernel =_mocks.Stub<IKernel>();
kernel.Stub(x => x.Get<Access>()).Return(access);
This throws an ArgumentNullException:
Message: Value cannot be null.
Parameter name: source
Stack Trace:
at System.Linq.Enumerable.Cast[TResult](IEnumerable source)
at Ninject.ResolutionExtensions.Get[T](IResolutionRoot root, IParameter[] parameters)
at MediaMover.Unit.Tests.ViewModelTests.OptionsViewModelTests.b__1(IKernel x) in C:\Users\Dave\Documents\Visual Studio 2010\Projects\Gigatube\MediaMover.Unit.Tests\ViewModelTests\OptionsViewModelTests.cs:line 33
at Rhino.Mocks.RhinoMocksExtensions.Expect[T,R](T mock, Function2 action)
at Rhino.Mocks.RhinoMocksExtensions.Stub[T,R](T mock, Function
2 action)
at MediaMover.Unit.Tests.ViewModelTests.OptionsViewModelTests.Initialize() in C:\Users\Dave\Documents\Visual Studio 2010\Projects\Gigatube\MediaMover.Unit.Tests\ViewModelTests\OptionsViewModelTests.cs:line 33