0

I want to fake my complex object (an object with 5 objects properties) to test the post method in the controller.

When I use FakeItEasy, I get the object with nulls, and I can't insert the object to the DbContext.

So how can I fake this? Manually?

Debuging my test

My Computer DTO:

public class Computer
{
    public long Id { get; set; }
    public Processor processor { get; set; }
    public ICollection<Memory> memories { get; set; }
    public ICollection<Disk> disks { get; set; }
    public MotherBoard motherBoard { get; set; }
    public ICollection<GPU> gpus { get; set; }
}
baruchiro
  • 5,088
  • 5
  • 44
  • 66
  • 1
    There is not enough information here for us to answer. Please read https://stackoverflow.com/help/how-to-ask and update your question. In particular, providing sample code that exhibits the bad behaviour will help immensely. In the meantime, there are a number of FakeitEasy questions to do with Entity Framework that you could scan in case one applies: https://stackoverflow.com/search?q=%5Bfakeiteasy%5D+entity+framework – Blair Conrad Nov 27 '18 at 20:32
  • 1
    `Computer` is a plain object, do not mock it, just create it with required data. – Fabio Dec 08 '18 at 06:37
  • @Fabio Can you direct me to a relevant article describe your point? – baruchiro Dec 08 '18 at 21:28

0 Answers0