public void SVNoDebePoderRetorarUnDeDoctor() { string id = null; var data = new List <Doctor> { new Doctor { Codigo = "jfuert", Apellidos = "Coral", Celular = "11111", IdDoctor = "ssssss", Nombres = "Anderson", NumeroDocumento = "4783434", TipoDocumento = TipoDocumento.DNI }, new Doctor { Apellidos = "GOMEZ MACEDO", Celular = "11111", IdDoctor = "ddddd", Nombres = "JAVIER ANGEL", NumeroDocumento = "4783434", TipoDocumento = TipoDocumento.DNI } }.AsQueryable(); var dbset = new Mock <DbSet <Doctor> >(); dbset.As <IQueryable <Doctor> >().Setup(m => m.Provider).Returns(data.Provider); dbset.As <IQueryable <Doctor> >().Setup(m => m.Expression).Returns(data.Expression); dbset.As <IQueryable <Doctor> >().Setup(m => m.ElementType).Returns(data.ElementType); dbset.As <IQueryable <Doctor> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator()); var context = new Mock <OpticaContext>(); context.Setup(a => a.Doctores).Returns(dbset.Object); var service = new DoctorService(context.Object); var doctor = service.DoctorModificar(id); Assert.IsNull(doctor); }