public RemoveParticipants ( int participantCount ) : void | ||
participantCount | int | The number of additional participants to remove from the barrier. |
리턴 | void |
/// <summary> /// Test RemoveParticipants /// </summary> /// <param name="initialCount">The initial barrier participants count</param> /// <param name="participantsToRemove">The aprticipants that will be added</param> /// <param name="exceptionType">Type of the exception in case of invalid input, null for valid cases</param> /// <returns>Tru if the test succeeded, false otherwise</returns> private static bool RunBarrierTest5_RemoveParticipants(int initialCount, int participantsToRemove, Type exceptionType) { TestHarness.TestLog("RemoveParticipants(" + initialCount + "," + participantsToRemove + ")"); Barrier b = new Barrier(initialCount); Exception exception = null; try { b.RemoveParticipants(participantsToRemove); if (b.ParticipantCount != initialCount - participantsToRemove) { TestHarness.TestLog("RemoveParticipants failed, total participant was not decreased"); return false; } } catch (Exception ex) { exception = ex; } if (exception != null && exceptionType == null) { TestHarness.TestLog("RemoveParticipants failed, unexpected exception has been thrown."); return false; } if (exception != null && !Type.Equals(exceptionType, exception.GetType())) { TestHarness.TestLog("RemoveParticipants failed, exceptions types do not match."); return false; } TestHarness.TestLog("RemoveParticipants succeeded"); return true; }