microsoft / SimpleStubs

*SimpleStubs* is a simple mocking framework that supports Universal Windows Platform (UWP), .NET Core and .NET framework. SimpleStubs is currently developed and maintained by Microsoft BigPark Studios in Vancouver.
Other
66 stars 29 forks source link

SimpleStubs.json file generating stubs for ignored interface #1

Closed yeasin90 closed 8 years ago

yeasin90 commented 8 years ago

I have an interface like below :

namespace RepoLib.Data.RepositoryInterface
{
    public interface IRepository<TDomain, TEntity> where TEntity : IEntity
    {
        Task InsertOrUpdateAsync(TDomain domainObject);
        Task InsertOrUpdateAsync(List<TDomain> domainObjects);
    }

    public interface IMyRepository : IRepository<MyDomainClass, MyEntityClass>
    {
        Task<List<MyDomainClass>> GetSomethingExceptional();
    }
}

namespace RepoLib.Data.Repository
{
    public interface MyRepository : IMyRepository 
    {
        // Interface implementation
    }
}

I don't want to generate stubs for IRepository interface, so I did below in SimpleStubs.json

{
    "IgnoredProjects": [
        "MyLib.Common",
        "MyLib.Domain",
        "MyLib.Framework"
      ],
  "IgnoredInterfaces": [
    "RepoLib.Data.RepositoryInterface.IRepository"
  ],
    "StubInternalInterfaces": false    
}

Problem is, when I build, it still generating stubs for IRepository

nehmebilal commented 8 years ago

Hi Yeasin,

I believe you need to specify the generic parameters as well:

RepoLib.Data.RepositoryInterface.IRepository<TDomain, TEntity>

Otherwise, simplestubs assumes that you are trying to exclude the non-generic interface. You can add both if you want to ignore both.

yeasin90 commented 8 years ago

Yes, now it's working thanks :) . I guess this can be added in the tutorial doc. I am closing this issue :+1:

nehmebilal commented 8 years ago

@yeasin90 Thanks for confirming. Also, please feel free to submit a PR for the tutorial enhancement you're suggesting :)