Mocking HttpContext.GetGlobalResourceObject in NUnit with Moq
问题 I am trying to write a unit test which tests a method that uses HttpContext.GetGlobalResourceObject() and I would like to mock it using Moq. Let's say we're testing this method: public List<DctmGridColumn> GetDctmColumnsMandatory() { List<DctmGridColumn> metadataFields = new List<DctmGridColumn> { new DctmGridColumn(HttpContext.GetGlobalResourceObject("SharePoint.Service", "DctmGridColumn_DispName_r_object_id").ToString()), new DctmGridColumn(HttpContext.GetGlobalResourceObject("SharePoint