c# - Nunit Mocking is little bit of confusing -


how mock query, want test in nunit. can me snippet?this exact service.cs, need mockup , nunit on same.

internal class sample : issample {   public sample( irepository<productvariant> productvariantrepository, irepository<product> productrepository)     {          _productvariantrepository = productvariantrepository;         _productrepository = productrepository;     }    public string getvalueabc(int a, int b)    {             vvar productvariantid =                 (from pv in _productvariantrepository.table                  join p in _productrepository.table on pv.productid equals p.id                  !p.deleted && !pv.deleted && p.id == sku                  orderby pv.published descending                  select pv.id).firstordefault();              if (productvariantid == 0)             {                 throw new errorcodeexception(catalogerrorcode.productvariantnotfound);             }            return "hi";      }  } 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -