Skip to content

Bird Watcher: unit test LastWeek calls method as static. #2475

@Mr-Lizard

Description

@Mr-Lizard

The current unit test for LastWeek() :

[Fact]
 [Task(1)]
 public void Last_week()
 {
     Assert.Equal(new int[] { 0, 2, 5, 3, 7, 8, 4 }, BirdCount.LastWeek());
 }

This is a static call, which is inconsistent with most of the API. I suggest changing it to non-static
otherwise birdsPerDay would have to be static, which would break many of the other methods.

Example fix:

    [Fact]
    [Task(1)]
    public void Last_week()
    {
        var counts = new int[] {  0, 2, 5, 3, 7, 8, 4 };
        var birdCount = new BirdCount(counts);
        Assert.Equal(new int[] { 0, 2, 5, 3, 7, 8, 4 }, birdCount.LastWeek());
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions