Legislative primaries on Tuesday will test the political center of both parties, but especially for Democrats in the Virginia Senate who already face the loss of a generation of leaders to retirements, hastened by redistricting that has transformed the state electoral map.