public async Task LoadReplace_RecordExists_ReturnsNewRecord() { // ARRANGE var datetime = DateTime.UtcNow; DocumentClient client = new DocumentClient( new Uri("https://localhost:8081"), "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="); var e = CosmosDBSqlApiArranger.GetEtlEventMock("EtlEvent_2018-06-22T01:00:00.000000Z"); DocumentLoader sut = new DocumentLoader( client, "cafdb", "items"); // ACT ResourceResponse <Document> result = await sut.LoadReplace(e); // ASSERT Assert.True(result.StatusCode == HttpStatusCode.OK); Assert.True(result.Resource.Timestamp > datetime); }
public async Task LoadReplace_RecordExists_ReturnsNewRecord() { // ARRANGE var datetime = DateTime.UtcNow; var e = CosmosDBSqlApiArranger.GetEtlEventMock("EtlEvent_2018-06-22T01:00:00.000000Z"); DocumentLoader sut = new DocumentLoader( client, "cafdb", "items"); // ACT ResourceResponse <Document> result = await sut.LoadReplace(e); // ASSERT Assert.True(result.StatusCode == HttpStatusCode.OK); Assert.InRange <DateTime>( result.Resource.Timestamp, datetime.Add(new TimeSpan(0, -1, 0)), datetime.Add(new TimeSpan(0, 1, 0))); }