public async Task ShouldGetIncrementalChanges() { var user = await _resource.CreateAsync( new UserCreateRequest("User Name") { Email = "*****@*****.**", }); // Querying every change in the last 5 minutes var now = DateTime.UtcNow.Subtract(new TimeSpan(0, 5, 0)); var changedUsers = await _resource.GetIncrementalExport(now); Assert.Equal(1, changedUsers.Count); Assert.Equal(user.Email, changedUsers.First().Email); Assert.False(changedUsers.HasMoreResults); // The second request with the end time of the previous request, should not return any var emptyResult = await _resource.GetIncrementalExport(changedUsers.EndTime); Assert.Equal(0, emptyResult.Count); Assert.Equal(changedUsers.EndTime, emptyResult.EndTime); }
public async Task ShouldGetAllUsersInGroup() { var obj1 = new UserCreateRequest("name") { Email = "*****@*****.**", DefaultGroupId = 1 }; var obj2 = new UserCreateRequest("name") { Email = "*****@*****.**", DefaultGroupId = 2 }; var objr1 = await _resource.CreateAsync(obj1); var objr2 = await _resource.CreateAsync(obj2); var obj1Result = (await _resource.ListInGroupAsync(1)).ToArray()[0]; var obj2Result = (await _resource.ListInGroupAsync(2)).ToArray()[0]; Assert.Equal(JsonConvert.SerializeObject(objr1), JsonConvert.SerializeObject(obj1Result)); Assert.Equal(JsonConvert.SerializeObject(objr2), JsonConvert.SerializeObject(obj2Result)); }