For some reason, the ReturnsMany method does not work for me. I have the follwing code:
List<ORGANIZATION> existingOrganizations = new List<ORGANIZATION>() { new ORGANIZATION() {ID = 1, NAME = "Organization1", ISINCLUDEDINSAMPLE = false}, new ORGANIZATION() {ID = 2, NAME = "Organization2", ISINCLUDEDINSAMPLE = false}, new ORGANIZATION() {ID = 3, NAME = "Organization3", ISINCLUDEDINSAMPLE = false}, };
container.Arrange<IOrganizationRepository>(or => or.GetById(Arg.AnyLong)).ReturnsMany(existingOrganizations);
And the exception I'm getting:
System.InvalidCastException : Unable to cast object of type 'System.Collections.Generic.List`1[Cpims.WFM.Domain.Organizations.ORGANIZATION]' to type 'Cpims.WFM.Domain.Organizations.ORGANIZATION'. at Castle.Proxies.IOrganizationRepositoryProxy.GetById(Int64 primaryKey, Expression`1[] includeNavigationProperties)