I just flew on Cape Air yesterday. They are a codeshare partner of CO.
They have no partner relationship whatsoever with NW.
Therefore, there would be no reason to expect any NW miles from flying Cape Air, codeshare or not.
For that segment, you'll definitely want to use your OnePass number.