asp.net mvc: how to mock Url.Content(“~”)?

后端 未结 4 1271
傲寒
傲寒 2021-01-19 07:12

anybody knows how to mock Url.Content(\"~\") ?

(BTW: I\'m using Moq)

4条回答
  •  Happy的楠姐
    2021-01-19 07:50

    controller.Url = Substitute.ForPartsOf();
    controller.Url.Content("~").Returns("path");
    

    Fell free with ForPartsOf (Partial subs and test spies) in NUnit

提交回复
热议问题