I have a class:
public class WeekCompareModel
{
public WeekData Week1 {get; set;}
public WeekData Week1 {get; set;}
}
This object is created like this:
var model = new WeekCompareModel
{
Week1 = Repo.FirstOrDefault(x => x.Typ == (int)type && x.Week == week1),
Week2 = Repo.FirstOrDefault(x => x.Typ == (int)type && x.Week == week2),
};
In my code this is instantiated in a manager class that implements a base class:
public class SystemStatisticsManager : CrudManagerBase<Systemstatistik>, ISystemStatisticsManager
{
public SystemStatisticsManager()
{
Repo = CoreRepository.Systemstatistiks;
}
...
}
My crudmanagerbase class:
public class CrudManagerBase<T> : ICrudManagerBase<T>
where T : class
{
protected readonly ICachedCoreRepository CoreRepository;
protected IQueryable<T> Repo;
...
}
What I would like to do in my unittest is to override the call to
new WeekCompareModel { ... }
and replaced it with a test instance of that model.
Any idea if this is possible with FakeItEasy or any other Mock library?