Add unit tests for the query and command builders

未關閉 適合新手
#17 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
88/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
csharp
領域
testing

研究方向

閱讀 QuickbaseNet/Helpers/QuickbaseQueryBuilder.cs 和 QuickbaseNet/Helpers/QuickbaseCommandBuilder.cs,接著參考 QuickbaseNet.UnitTests/Tests/QuickbaseClientTests.cs 的風格。在 QuickbaseNet.UnitTests/Tests/ 下新增指定的兩個 builder 測試檔案,並透過建立 request、驗證回傳的物件來涵蓋列出的每種行為。執行 dotnet test --filter FullyQualifiedName~BuilderTests;所有案例都通過,且 QuickbaseNet/ 下沒有檔案變更時,即為完成。

由索引模型根據 Issue 內容生成。

描述

good first issue

Neither builder has a test. The 7 existing tests cover the client constructor, QueryRecords and QuickbaseResult. Builder tests don't need the HTTP mock: build a request and assert on the object you get back.

What to do

Add QuickbaseQueryBuilderTests.cs and QuickbaseCommandBuilderTests.cs under QuickbaseNet.UnitTests/Tests/, in the style of the existing tests. Cover at least:

  • Build() copies From, Select and Where into the request.
  • SortBy and GroupBy called twice keep both items, in order.
  • Select called twice keeps only the last list.
  • With nothing set, SortBy, GroupBy and Options are null.
  • AddNewRecord twice gives two entries in Data, and ReturnFields ends up in FieldsToReturn.
  • UpdateRecord(8, ...) adds field "3" with the string value "8" next to the configured fields.
  • AddFields sets every field, and AddField twice on one ID keeps the last value.
  • BuildDeleteCommand maps ForTable to From and WithDeletionCriteria to Where.

Test what the builders do today. If something looks wrong, say so in the PR instead of changing the builder.

Where to look

  • QuickbaseNet/Helpers/QuickbaseQueryBuilder.cs
  • QuickbaseNet/Helpers/QuickbaseCommandBuilder.cs (field 3 is set at line 65)
  • QuickbaseNet.UnitTests/Tests/QuickbaseClientTests.cs for style

Done when

  • Every case above has a passing test
  • Nothing under QuickbaseNet/ changes

Testing it

dotnet test --filter FullyQualifiedName~BuilderTests
主要語言
C#
星號
3
分支
2
平均合併
3 小時 14 分鐘
30 天內合併 PR
2

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

hazeliscoding/quickbase-net 的其他 Issue

查看 hazeliscoding/quickbase-net 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。