Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beitrag Lucas #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Beitrag Lucas #1

wants to merge 1 commit into from

Conversation

AlCaponi
Copy link
Collaborator

No description provided.

// Act: Versuche, einen neuen TimelogType mit ungültigen Daten zu erstellen
var result = controller.CreateTimelogType(invalidTimelogType);

//Todo: Assert: Überprüfe, ob das Ergebnis ein BadRequestObjectResult ist und die Fehlermeldung enthält
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kein Assert

// Assert: Überprüfe, ob das Ergebnis vom korrekten Typ ist und die erwartete Anzahl an Elementen enthält.// Assert
var viewResult = Assert.IsType<ActionResult<List<TimelogTypeResponse>>>(result);
var model = Assert.IsAssignableFrom<List<TimelogTypeResponse>>(viewResult.Value);
Assert.Equal(6, model.Count()); // Es werden 5 Elemente erwartet plus das eine Element was im CreateTimelogType_Validation_Fails_ForInvalidData() erstellt wird.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abhängigkeit zu anderen Tests

public string timelogType { get; set; }

// Budget muss grösser oder gleich 0 sein
[Range(0, double.MaxValue, ErrorMessage = "Das Zeitbudget darf nicht negativ ")]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datatypen validierung, super!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant