internal static T DonotUpdateAccountOnTxnsAsyncFrance <T>(ServiceContext context, T entity) where T : IEntity { //Initializing the Dataservice object with ServiceContext DataService.DataService service = new DataService.DataService(context); bool isUpdated = false; // Used to signal the waiting test thread that a async operation have completed. ManualResetEvent manualEvent = new ManualResetEvent(false); IdsException exp = null; T returnedEntity = entity; // Async callback events are anonomous and are in the same scope as the test code, // and therefore have access to the manualEvent variable. //check this line for change service.OnDoNotUpdateAccAsyncCompleted += (sender, e) => { isUpdated = true; manualEvent.Set(); if (e.Error != null) { exp = e.Error; } else { if (e.Entity != null) { returnedEntity = (T)e.Entity; } } }; // Call the service method service.DoNotUpdateAccountOnTxns(entity); manualEvent.WaitOne(30000, false); Thread.Sleep(10000); if (exp != null) { throw exp; } // Check if we completed the async call, or fail the test if we timed out. if (!isUpdated) { Assert.Fail("DoNotUpdateAccountOnTxns Failed"); } //if entity is returned returnedEntity will be set with new object with same values Assert.AreNotEqual(returnedEntity, entity); // Set the event to non-signaled before making next async call. manualEvent.Reset(); return(returnedEntity); }
internal static T DonotUpdateAccountOnTxnsFrance <T>(ServiceContext context, T entity) where T : IEntity { //initializing the dataservice object with servicecontext DataService.DataService service = new DataService.DataService(context); //updating the entity // do not update account for historical transactions T updated = service.DoNotUpdateAccountOnTxns <T>(entity); return(updated); }