Esempio n. 1
0
    public async Task GetTodos()
    {
        await using var application = new TodoApplication();

        var client = application.CreateClient();
        var todos  = await client.GetFromJsonAsync <List <Todo> >("/todos");

        Assert.Empty(todos);
    }
Esempio n. 2
0
    public async Task PostTodos()
    {
        await using var application = new TodoApplication();

        var client   = application.CreateClient();
        var response = await client.PostAsJsonAsync("/todos", new Todo { Title = "I want to do this thing tomorrow" });

        Assert.Equal(HttpStatusCode.Created, response.StatusCode);

        var todos = await client.GetFromJsonAsync <List <Todo> >("/todos");

        var todo = Assert.Single(todos);

        Assert.Equal("I want to do this thing tomorrow", todo.Title);
        Assert.False(todo.IsComplete);
    }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var application = new TodoApplication();

            application.Run();
        }
Esempio n. 4
0
        static void Main()
        {
            var app = new TodoApplication();

            app.Run();
        }