Пример #1
0
    public async Task ShouldListToDoItems()
    {
        // Arrange
        _todoContext.ReSeedDatabase();
        var expectedReturnCount = SeedData.ToDoItems.Count;

        // Act
        var response = await _client.GetAsync("/ToDoItems");

        response.EnsureSuccessStatusCode();
        var items = await DeserializeResponseAsync <ODataCollection <ToDoItem> >(response);

        // Assert
        // GET should return 200
        Assert.Equal(System.Net.HttpStatusCode.OK, response.StatusCode);

        // GET with no params should return all initial items
        Assert.NotNull(items?.Value);
        Assert.Equal(expectedReturnCount, items !.Value.Count);
    }