public void GENERIC_SERVICE_GET_ITEM_TEST() { //Given DomainBaseEntity actual; BaseEntity entity = new BaseEntity { Id = 1 }; Mock <IGenericRepository <BaseEntity> > _Repository = new Mock <IGenericRepository <BaseEntity> >(); _Repository.Setup(m => m.GetSingle(It.IsAny <Expression <Func <BaseEntity, bool> > >())) .Returns(entity).Verifiable(); GenericService _Service = new GenericService(_Repository.Object); //When actual = _Service.GetItem(1); //Then _Repository.Verify(); Assert.IsInstanceOf <DomainBaseEntity>(actual); Assert.IsNotNull(actual); }