vendredi 8 avril 2016

Unit Testing System.NullReferenceException: Object reference not set to an instance of an object

I am having an issue setting up a particular Mock and I was wondering whats wrong with it

public class XXX : xxxx
{
    private readonly OneService _oneService;
    private readonly PhoneContext _phoneContext;
    private readonly ContenRepo _someService;

public XXX (OneService oneService, PhoneContext phoneContext, ContenRepo  someService)
        {
            _oneService = oneService;
            _phoneContext = phoneContext;
            _someService = someService;
        }

public ShowHere HeadingH()
        {
            var titlesH = _someService.GetAllCarStrings(CarStringXollection.CarLabels, _phoneContext.ToMio());
            var GeitSytructure = new StructuringModeler
            {
                LordName = LordNameBig.Car,
                Prefss = new PreffSets
                {
                    Links = GetCarLinks(),
                    Lookers = GetLookerData(),
                    Top = titlesH ["Toyota_corolla"]
                },
                Mio = GetMio()
            };
            return Sytructure(GeitSytructure);
        }

I am stuck now having to write a mock setup for the ContenRepo The rest are fine, just stuck on this setup.

I tired:

_someService.Setup(x => x.QueryNames(It.IsAny<ContenRepo>())).Returns();

Aucun commentaire:

Enregistrer un commentaire