I was able to code the ExtractTestSamples method for various scenarios.