-
Notifications
You must be signed in to change notification settings - Fork 0
/
JobSeekingUnitTests.cs
46 lines (37 loc) · 1.13 KB
/
JobSeekingUnitTests.cs
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
using Xunit;
namespace practicing_design_patterns.behavioral.@object.observer.job_seeking
{
public class JobSeekingUnitTests
{
[Fact]
public void JoeAndJackDaltonGetEmployed()
{
// Arrange
var joeDalton = new JobSeeker("Joe Dalton");
var jackDalton = new JobSeeker("Jack Dalton");
var jobPostings = new JobPostings();
jobPostings.Subscribe(joeDalton, jackDalton);
// Act
jobPostings.AddJob(new JobPost("Bank Robbery"));
// Assert
Assert.True(joeDalton.IsEmployed());
Assert.True(jackDalton.IsEmployed());
}
[Fact]
public void JackDaltonNotInterestedInGettingJob()
{
// Arrange
var joeDalton = new JobSeeker("Joe Dalton");
var jackDalton = new JobSeeker("Jack Dalton");
var jobPostings = new JobPostings();
jobPostings.Subscribe(joeDalton, jackDalton);
// (Jack is not intereseted in job)
jobPostings.Unsubscribe(jackDalton);
// Act
jobPostings.AddJob(new JobPost("Bank Robbery"));
// Assert
Assert.True(joeDalton.IsEmployed());
Assert.False(jackDalton.IsEmployed());
}
}
}