RajOpteamix / moq

Automatically exported from code.google.com/p/moq
Other
0 stars 0 forks source link

.Setup throws error method may only be called on type for which type.IsGeneric is true #367

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Method to be setup =>
   public List<Return> GetAllReturnsForRange(DateTime? startDate, DateTime? endDate, List<int> systemStatusFilter)
        {
            return result;
        }
2. Setup statement =>
     mockReturnRepo.Setup(r => r.GetAllReturnsForRange(It.IsAny<DateTime?>(), It.IsAny<DateTime?>(), integerList))
                          .Returns(mockDb.GiveMeTable<Return>);
3.   Return method from mockDB  =>
         public List<T> GiveMeTable<T>()
        {
            return GetTable<T>();
        }

What is the expected output? What do you see instead?
Expect a List if Return items.  null returned

Debug shows that method (GetAllReturnsForRange()) is not being setup due to 
above exception being thrown.   Test failing because no object returned.

What version of the product are you using? On what operating system?
MOQ Version 4.0.10827
.Net 4.0 on Windows 7 

Please provide any additional information below.
Exception is not being caught.  Only found by debug of the execution.

Original issue reported on code.google.com by phil.s.d...@disney.com on 6 Aug 2013 at 3:43