Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

tests: add the first tests for ViewLocator

Abierto Apto para principiantes
#341 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
88/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp

Línea de trabajo

Añade un archivo de pruebas en tests/LageBuch.Acceptance.Tests/ para src/LageBuch.App.Shared/ViewLocator.cs. Empieza leyendo ViewLocator.cs y NumericInputTests.cs y, después, ejecuta make test PROJECT=tests/LageBuch.Acceptance.Tests FILTER=Name~ViewLocator. Cubre el fallback de null, el fallback cuando falta la vista y las aserciones de Match; las pruebas filtradas deberían pasar.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C#
Estrellas
1
Forks
3
Merge medio
4 h 34 min
PR fusionados (30 d)
182

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de CodeForFire/lagebuch

Todos los issues de CodeForFire/lagebuch

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.