iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 19
0
Software Development

【Unit Test】Unit Test with C#系列 第 19

【Day 19】隔離框架2-NSubstitute簡介

這邊會稍微介紹NSunbstitute是什麼,以及如何安裝。


NSubstitute,是一個開源的專案,可以從Github下載,使用VS者可以從Nuget安裝。
此framework是可以方便使用者快速建立測試的模擬物件。使用者不用費心去設計mock和stub,只要專心在測試的內容上。
而本書作者之所以會選擇此工具,除了是個優秀的framework,文件內容很完整,所以選此工具為書中範本。

以下為VS的安裝說明。

  1. 首先先進入Nuget,找到「Nuget封裝管理員」。
    https://ithelp.ithome.com.tw/upload/images/20171225/20103826RHZDFxHQlo.png

  2. 接著在搜尋內的資料,取得NSubstitute的下載項目。
    https://ithelp.ithome.com.tw/upload/images/20171225/201038268aTf0CW7yd.png

  3. 安裝的時候遇到相依性問題。
    https://ithelp.ithome.com.tw/upload/images/20171225/20103826vwr8YRfFUd.png

  4. 「接受授權」,選擇「NSubstitute」。
    https://ithelp.ithome.com.tw/upload/images/20171225/20103826Ha1KsLMYlr.png

  5. 最後把東西安裝完吧!
    https://ithelp.ithome.com.tw/upload/images/20171225/20103826LUS8Z7rIMW.png

這樣就安裝完囉~~


明天將會講如何執行第一個「hello」。


上一篇
【Day 18】初談「隔離框架」(isolation framework)
下一篇
【Day 20】NSubstitue 2 -第一個測試
系列文
【Unit Test】Unit Test with C#31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言