public async void ApplyAsync() { bool resultPersonGroup = false; var objectType = "PersonGroup"; var mode = "CreateNew"; TakeResult takeSnapshotResult = null; GetOperationStatusResult operationResult = null; string id = null; applyScope[2] = SubscriptionID; bool applySnapshot_result = false; try { var creation_result = await ApiReference.Instance.PersonGroup.CreateAsync(identifier, identifier, identifier); resultPersonGroup = await ApiReference.Instance.FaceList.CreateAsync(identifier, identifier, identifier); takeSnapshotResult = await ApiReference.Instance.Snapshot.TakeAsync(objectType, identifier, applyScope, identifier); while (true) { Task.Delay(1000).Wait(); operationResult = await ApiReference.Instance.Snapshot.GetOperationStatusAsync(takeSnapshotResult.OperationLocation); if (operationResult.status != "running") { break; } } id = operationResult.resourceLocation.Split("/")[2]; applySnapshot_result = await ApiReference.Instance.Snapshot.ApplyAsync(id, "new" + identifier, mode); } catch (Exception) { throw; } finally { var deleted = DeleteResources(identifier, id); } Assert.True(applySnapshot_result); }
public async void UpdateAsync() { bool result = false; bool resultPersonGroup = false; string userData = string.Empty; TakeResult takeSnapshotResult = null; var objectType = "PersonGroup"; List <ListResult> listResult = null; GetOperationStatusResult operationResult = null; try { resultPersonGroup = await ApiReference.Instance.PersonGroup.CreateAsync(identifier, identifier, identifier); takeSnapshotResult = await ApiReference.Instance.Snapshot.TakeAsync(objectType, identifier, applyScope, identifier); while (true) { System.Threading.Tasks.Task.Delay(1000).Wait(); operationResult = await ApiReference.Instance.Snapshot.GetOperationStatusAsync(takeSnapshotResult.OperationLocation); if (operationResult.status != "running") { break; } } listResult = await ApiReference.Instance.Snapshot.ListAsync(objectType, applyScope.First()); result = await ApiReference.Instance.Snapshot.UpdateAsync(listResult.First().id, applyScope.Skip(1).ToArray(), userData); } catch { throw; } finally { var id = operationResult.resourceLocation.Split("/")[2]; var deleted = DeleteResources(identifier, id); } Assert.True(result); }
public async void GetAsync() { bool resultPersonGroup = false; var objectType = "PersonGroup"; GetResult result = null; TakeResult takeSnapshotResult = null; GetOperationStatusResult operationResult = null; string id = null; //Add PersonGroup and Take Operation try { resultPersonGroup = await ApiReference.Instance.PersonGroup.CreateAsync(identifier, identifier, identifier); takeSnapshotResult = await ApiReference.Instance.Snapshot.TakeAsync(objectType, identifier, applyScope, identifier); while (true) { Task.Delay(1000).Wait(); operationResult = await ApiReference.Instance.Snapshot.GetOperationStatusAsync(takeSnapshotResult.OperationLocation); if (operationResult.status != "running") { break; } } id = operationResult.resourceLocation.Split("/")[2]; result = await ApiReference.Instance.Snapshot.GetAsync(id); } catch { throw; } finally { var deleted = DeleteResources(identifier, id); } Assert.True(result != null); }
public async void TakeAsync() { bool result = false; TakeResult takeSnapshotResult = null; var objectType = "PersonGroup"; GetOperationStatusResult operationResult = null; //Add PersonGroup to transfer try { result = await ApiReference.Instance.PersonGroup.CreateAsync(identifier, identifier, identifier); takeSnapshotResult = await ApiReference.Instance.Snapshot.TakeAsync(objectType, identifier, applyScope, identifier); while (true) { System.Threading.Tasks.Task.Delay(1000).Wait(); operationResult = await ApiReference.Instance.Snapshot.GetOperationStatusAsync(takeSnapshotResult.OperationLocation); if (operationResult.status != "running") { break; } } } catch (Exception) { throw; } finally { var id = operationResult.resourceLocation.Split("/")[2]; var deleted = DeleteResources(identifier, id); } Assert.True(takeSnapshotResult != null); }