Ejemplo n.º 1
0
    public async Task ShouldBeAbleToCreateATodo()
    {
        //GIVEN
        await using var driver = await TodoAppDriver.CreateInstance();

        //WHEN
        var addTodoResponse = await driver.AttemptToAddNewTodo(AddTodoDtoBuilder.UniqueTodo());

        //THEN
        addTodoResponse.ShouldBeSuccessful();
    }
Ejemplo n.º 2
0
    public async Task <AddTodoResponse> AttemptToAddNewTodo(AddTodoDtoBuilder addTodoDtoBuilder)
    {
        var addTodoDto = addTodoDtoBuilder.Build();

        var response = await _appFactory.FlurlClient()
                       .Request("/todo")
                       .WithHeader("Authorization", "Bearer " + TestTokens.GenerateToken())
                       .WithHeader("Content-Type", MediaTypeNames.Application.Json)
                       .WithHeader("Accept", MediaTypeNames.Application.Json)
                       .SetQueryParam("customerId", Any.String())
                       .AllowAnyHttpStatus()
                       .PostJsonAsync(addTodoDto);

        return(new AddTodoResponse(response));
    }
Ejemplo n.º 3
0
    public async Task ShouldBeAbleToLinkTodos()
    {
        //GIVEN
        await using var driver = await TodoAppDriver.CreateInstance();

        var addTodo1Response = await driver.AddNewTodo(AddTodoDtoBuilder.UniqueTodo());

        var addTodo2Response = await driver.AddNewTodo(AddTodoDtoBuilder.UniqueTodo());

        var id1 = await addTodo1Response.GetTodoId();

        var id2 = await addTodo2Response.GetTodoId();

        //WHEN
        var linkResponse = await driver.AttemptToLinkTodos(id1, id2);

        //THEN
        linkResponse.ShouldBeSuccessful();
        //bug This is not enough. Why do we link the TODOs?
    }
Ejemplo n.º 4
0
 public async Task <AddTodoResponse> AddNewTodo(AddTodoDtoBuilder addTodoDtoBuilder)
 {
     return((await AttemptToAddNewTodo(addTodoDtoBuilder)).ShouldBeSuccessful());
 }