-
-
Notifications
You must be signed in to change notification settings - Fork 379
Expand file tree
/
Copy pathBirdWatcherTests.cs
More file actions
103 lines (92 loc) · 2.69 KB
/
BirdWatcherTests.cs
File metadata and controls
103 lines (92 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using Exercism.Tests;
public class BirdWatcherTests
{
[Fact]
[Task(1)]
public void Last_week()
{
Assert.Equal(new int[] { 0, 2, 5, 3, 7, 8, 4 }, BirdCount.LastWeek());
}
[Fact]
[Task(2)]
public void Today_for_disappointing_day()
{
var counts = new int[] { 0, 0, 1, 0, 0, 1, 0 };
var birdCount = new BirdCount(counts);
Assert.Equal(0, birdCount.Today());
}
[Fact]
[Task(2)]
public void Today_for_busy_day()
{
var counts = new int[] { 8, 8, 9, 5, 4, 7, 10 };
var birdCount = new BirdCount(counts);
Assert.Equal(10, birdCount.Today());
}
[Fact]
[Task(3)]
public void Increment_todays_count_with_no_previous_visits()
{
var counts = new int[] { 0, 0, 0, 4, 2, 3, 0 };
var birdCount = new BirdCount(counts);
birdCount.IncrementTodaysCount();
Assert.Equal(1, birdCount.Today());
}
[Fact]
[Task(3)]
public void Increment_todays_count_with_multiple_previous_visits()
{
var counts = new int[] { 8, 8, 9, 2, 1, 6, 4 };
var birdCount = new BirdCount(counts);
birdCount.IncrementTodaysCount();
Assert.Equal(5, birdCount.Today());
}
[Fact]
[Task(4)]
public void Has_day_without_birds_with_day_without_birds()
{
var counts = new int[] { 5, 5, 4, 0, 7, 6, 7 };
var birdCount = new BirdCount(counts);
Assert.True(birdCount.HasDayWithoutBirds());
}
[Fact]
[Task(4)]
public void Has_day_without_birds_with_no_day_without_birds()
{
var counts = new int[] { 4, 5, 9, 10, 9, 4, 3 };
var birdCount = new BirdCount(counts);
Assert.False(birdCount.HasDayWithoutBirds());
}
[Fact]
[Task(5)]
public void Count_for_first_three_days_of_disappointing_week()
{
var counts = new int[] { 0, 0, 1, 0, 0, 1, 0 };
var birdCount = new BirdCount(counts);
Assert.Equal(1, birdCount.CountForFirstDays(3));
}
[Fact]
[Task(5)]
public void Count_for_first_six_days_of_busy_week()
{
var counts = new int[] { 5, 9, 12, 6, 8, 8, 17 };
var birdCount = new BirdCount(counts);
Assert.Equal(48, birdCount.CountForFirstDays(6));
}
[Fact]
[Task(6)]
public void Busy_days_for_disappointing_week()
{
var counts = new int[] { 1, 1, 1, 0, 0, 0, 0 };
var birdCount = new BirdCount(counts);
Assert.Equal(0, birdCount.BusyDays());
}
[Fact]
[Task(6)]
public void Busy_days_for_busy_week()
{
var counts = new int[] { 4, 9, 5, 7, 8, 8, 2 };
var birdCount = new BirdCount(counts);
Assert.Equal(5, birdCount.BusyDays());
}
}