public async Task ListByExternalIdsAsync_WhenCalledWithExternalIds_ShouldGetAllUsers() { var results = await _resource.ListByExternalIdsAsync(new string[] { "1", "2", "3" }); Assert.Equal(3, results.Count); for (var i = 1; i <= 3; i++) { var user = results.ElementAt(i - 1); Assert.Equal($"name.{i}", user.Name); Assert.Equal(i.ToString(), user.ExternalId); } }
public async Task ShouldGetAllUsersByExternalId() { var obj1 = await _resource.CreateAsync(new UserCreateRequest("name") { Email = "*****@*****.**" }); var obj2 = await _resource.CreateAsync(new UserCreateRequest("name") { Email = "*****@*****.**", ExternalId = "ATEST1" }); var obj3 = await _resource.CreateAsync(new UserCreateRequest("name") { Email = "*****@*****.**", ExternalId = "ATEST2" }); var objs = (await _resource.ListByExternalIdsAsync(new[] { obj1.ExternalId, obj2.ExternalId, obj3.ExternalId })).ToArray(); Assert.Equal(2, objs.Length); Assert.Equal(JsonConvert.SerializeObject(obj2), JsonConvert.SerializeObject(objs[0])); Assert.Equal(JsonConvert.SerializeObject(obj3), JsonConvert.SerializeObject(objs[1])); }