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
Post a Comment