Skip to content

Beitrag Lucas#1

Open
AlCaponi wants to merge 1 commit intomainfrom
LucasNicolasSchulz
Open

Beitrag Lucas#1
AlCaponi wants to merge 1 commit intomainfrom
LucasNicolasSchulz

Conversation

@AlCaponi
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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