Add unit test class for _order_dms

This function is more complicated now so it makes sense to explicitly test it.