This model of a D-Flip flop with Enable not working as expected
In your first code sample, you have a low active reset (if (~Reset) D &lt;= 0). And in the testbench you hold Reset low for most of the simulation. As expected this results in D being 0.

In your second code sample you have a high-active reset (if (reset) q &lt;= 0 ) which will naturally behave differently.