-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathProcessEmployeeTests.cs
51 lines (40 loc) · 1.51 KB
/
ProcessEmployeeTests.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
47
48
49
50
51
using System.Net;
using FluentAssertions;
using KinesisEventHandler.IntegrationTests.Utilities;
using Xunit;
namespace KinesisEventHandler.IntegrationTests;
public class ProcessEmployeeTests : IClassFixture<ProcessEmployeeFixture>
{
private readonly ProcessEmployeeFixture _processEmployeeFixture;
public ProcessEmployeeTests(ProcessEmployeeFixture processEmployeeFixture)
{
_processEmployeeFixture = processEmployeeFixture;
}
[Fact]
public async Task WriteToEmployeeRecordsStream_Should_Return_HTTP_OK()
{
//Arrange
var employee = new EmployeeBuilder().Build();
//Act
var response = await _processEmployeeFixture.StreamRecordAsync(employee);
//Assert
response.Should().NotBeNull();
response.HttpStatusCode.Should().Be(HttpStatusCode.OK);
//Dispose
_processEmployeeFixture.CreatedEmployeeIds.Add(employee.EmployeeId);
}
[Fact]
public async Task WriteToEmployeeRecordsStream_Should_Upsert_To_EmployeeStreamTable()
{
//Arrange
var employee = new EmployeeBuilder().Build();
//Act
using var cts = new CancellationTokenSource();
await _processEmployeeFixture.StreamRecordAsync(employee);
var response = await _processEmployeeFixture.PollForProcessedMessage(employee, cts.Token);
//Assert
response.Should().NotBeNull().And.BeEquivalentTo(employee);
//Dispose
_processEmployeeFixture.CreatedEmployeeIds.Add(employee.EmployeeId);
}
}