Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

tests: add the first tests for ViewLocator

オープン 初心者向け
#341 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp

調査の方向性

src/LageBuch.App.Shared/ViewLocator.cs 用のテストファイルを tests/LageBuch.Acceptance.Tests/ の下に追加してください。まず ViewLocator.cs と NumericInputTests.cs を読み、次に make test PROJECT=tests/LageBuch.Acceptance.Tests FILTER=Name~ViewLocator を実行してください。null のフォールバック、ビューが見つからない場合のフォールバック、Match のアサーションを網羅してください。フィルターされたテストが成功するはずです。

索引モデルが issue の本文から書いたものです。

説明

good first issue tests

src/LageBuch.App.Shared/ViewLocator.cs maps a view model to its view by string
convention: it replaces ViewModel with View in the type name and resolves
that type. Convention-based resolution breaks quietly when a file is renamed,
and there is no test file for it anywhere — the only mention in tests/ is a
passing comment in ForcesTabRenderTests.cs.

What to do

Add a new test file in tests/LageBuch.Acceptance.Tests/ (the only test project
that references LageBuch.App.Shared). Three cheap assertions cover the whole
class:

  1. Build(null) returns a TextBlock whose text is the em-dash placeholder.
  2. Build(x) for an ObservableObject subclass with no matching view returns a
    TextBlock starting with Nicht gefunden:.
  3. Match is true for a CommunityToolkit.Mvvm.ComponentModel.ObservableObject
    and false for a plain object.

The two fallback paths construct a TextBlock only, so a plain [Fact] is
enough and you do not need the Avalonia dispatcher. If you want to also assert
that a real view model resolves to its view, use [AvaloniaFact] and copy the
setup from NumericInputTests.cs in the same project.

Note this project is on xunit.v3 while the other test projects are on v2.

Verify
make test PROJECT=tests/LageBuch.Acceptance.Tests FILTER=Name~ViewLocator

Difficulty: easy.


New here?

Comment to claim this issue and it is yours. If no pull request appears within
seven days it goes back in the pool, no hard feelings.

Before you open the PR, please skim CONTRIBUTING.md:
commits need DCO sign-off (git commit -s) and a Conventional Commit subject.
Changes under src/ additionally need an entry under ## [Unreleased] in
CHANGELOG.md — CI fails the PR otherwise.

Questions are welcome right here or in
Discussions.

主要言語
C#
スター
1
フォーク
3
平均マージ
4時間 34分
マージ済み PR(30日)
182

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CodeForFire/lagebuch のほかの issue

CodeForFire/lagebuch の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。