Open msallin opened 8 years ago
Hi, thanks for reporting this. From the looks of it, TEntity
is most likely a generic type parameter, and not an actual type. Can you confirm this? Can you expand the code example to a minimal, complete example that illustrates how/where TEntity is defined?
I'm calling a method which looks like that.
protected virtual async Task<IList<TEntity>> AddEntities(int amount, Action<TEntity> action)
{
IList<TEntity> entityList = new List<TEntity>();
for (int i = 0; i < amount; i++)
{
TEntity entity = CreateEntity();
action(entity);
var result = await Repository.InsertAsync(entity);
result.EnsureIsValid();
entityList.Add(entity);
}
return entityList;
}
Where the TEntity is RepositoryFixture<TEntity, TFilter, TRepository> : Fixture where TEntity : IEntity where TFilter : IFilter where TRepository : IRepository<TEntity, TFilter>
This appears to be a bug. I will investigate and fix it in the near future. Thanks for reporting again!
Hi
To make it easier to reproduce I created a new project which contains the structure we use. You can download it here: https://onedrive.live.com/redir?resid=C8E1BE3E79378699!631447&authkey=!AMlmgIqoGQ70pwI&ithint=file%2czip
Here I use Moq to abstract the repository. In the real tests there is a repository which abstracts the Entity Framework to access the database. I'm not sure if this is relevant for this bug.
However, I'm also not able to get this project run. There is another exception which is thrown. May this is depended to the this issue.
Please let me know when you need additional help.
Greetings
Hello @vanderkleij This bug is resolved or not? As I am facing the same issue of NullReferenceException while using Smocks. I tried to run the examples which you gave in the Readme file, they are giving the same exceptions.
Hello @vanderkleij @ujeshmaurya This bug is resolved or not? As I am facing the same issue
I am also today, trying to smock DateTime.Now / Today Probably the most common use case and seems to be a common problem below Enterprise version...
Hi
I try to use Smock like this
Then I get a null reference:
Is this a bug or a limitation?
EDIT: For the same code, when running a different test I get another error