Advertisement
Guest User

Untitled

a guest
May 3rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. public class FindSimilarPeopleTests : CommandTest {
  2.  
  3.         [Fact]
  4.         public async Task FindsPeopleWithTheSameBirthday() {
  5.             //assemble
  6.             var people = new[] {
  7.                 new Person { Email = "tammytwofingers@test.com", DateOfBirth = new DateTime(1999, 1, 1), },
  8.                 new Person { Email = "timmy-tuna@test.com", DateOfBirth = new DateTime(1999, 1, 1) },
  9.                 new Person { Email = "testymctestface@test.com", DateOfBirth = new DateTime(2000, 2, 2) }
  10.             };
  11.             await this.mockSession.InsertAsync(people);
  12.  
  13.             //act
  14.             var actual = await this.mockMasterbrain.ExecuteAsync(new FindSimilarPeople(people.First()));
  15.  
  16.             //assert
  17.             Assert.Equal(2, actual.Length);
  18.             Assert.Equal(people.First(), actual.First());
  19.             Assert.False(actual.Contains(people.Last()));
  20.         }
  21.  
  22.         [Fact]
  23.         public async Task FindsThoseWithSameEmails() {
  24.             var people = new[] {
  25.                 new Person { FirstName = "Harry", Email = "testy@test.com" , DateOfBirth = new DateTime(2000, 1, 1) },
  26.                 new Person { FirstName = "Barry", Email = "testy@test.com" , DateOfBirth = new DateTime(2000, 2, 2) },
  27.                 new Person { FirstName = "Larry", Email = "mlp-larp-king@test.com" , DateOfBirth = new DateTime(2000, 3, 3) }
  28.             };
  29.             await this.mockSession.InsertAsync(people);
  30.  
  31.             var actual = await this.mockMasterbrain.ExecuteAsync(new FindSimilarPeople(people.First()));
  32.  
  33.             Assert.Equal(2, actual.Length);
  34.             Assert.Equal(people.First(), actual.First());
  35.             Assert.False(actual.Contains(people.Last()));
  36.         }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement