Need some advice for trying to mock a .NET WebClient or equivalent

后端 未结 2 1501
抹茶落季
抹茶落季 2020-12-18 18:59

I\'ve got some code which downloads some RSS feeds.

I\'ve been using WebClient or Argotic.Syndication.RssFeed libraries.

Bu

2条回答
  •  执笔经年
    2020-12-18 19:55

    I go for creating a wrapper for every external dependency (if it's practical). So, every interaction with the filesystem/a webservice/database should be done through an interface only, which will lead to more testable code.

    Another solution of course is (as always) Typemock Isolator.

提交回复
热议问题