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

add tests #3

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

add tests #3

wants to merge 1 commit into from

Conversation

csskroubledev
Copy link
Owner

No description provided.

[Fact]
public async Task Get_ReturnsBookFromDatabase()
{
using var scope = _factory.Services.CreateScope();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The AAA (Arrange, Act, Assert) pattern is a common way of writing unit tests for a method under test.

The Arrange section of a unit test method initializes objects and sets the value of the data that is passed to the method under test.

The Act section invokes the method under test with the arranged parameters.

The Assert section verifies that the action of the method under test behaves as expected. For .NET, methods in the Assert class are often used for verification.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Czyli w skrócie można podzielić na 3 sekcje, które są rozdzielane pustą linią

var client = _factory.CreateClient();

var response = await client.DeleteAsync("api/BookStore/1");
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Można dać asercje na to czy faktycznie zostało usunięte czy nie

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.

2 participants