The sample workflow code for calculating taxes looks up tax categories per lineItem to calculate both shipping tax and tax for each item in cart. In the most simple example tax category A (sale) and shipping tax will have same tax category. When asking for taxes per line item you will then get two; one sale and one shipping.
But what if a line item have tax category B (sale). If I only have that item in cart, I will not get the shipping tax (since line item have another tax category), only the sale tax for category B.
What is the correct way of retrieving the tax value for shipping?
The tax calculation currently depends on Line Item and Shipping Address - for both sale tax or shipping tax. When line item is tax category A, we have both sale tax and shiping tax for category A. And line item is category B, we should define both sale tax and shipping tax for category B. This is default (for US market).
So in this case, defining a shipping tax for category B is one of solutions.
However, the tax calculation was flexible, we won't know what way is correct or not. It depends on market, US is different from EU or Asia - that's the reason we allow customizing tax calculation. You could customze tax calculation in your own way, in market you support, in your bussiness.
We could design tax calculation doesn't depend on item tax category, it depends on item type instead. For example, Fashion type has tax = 10%, Shoes has tax = 5% and Hat has tax = 7%...
Or we don't need customers create the order Shipping Adderss for tax calculating, we could use their prefer address to calculate tax, ...
That means it could be your choice, your way.
For customizing, you could prefer to this document http://world.episerver.com/documentation/Class-library/?documentId=commerce/9/7426E63C
Hope this helps!
Fyi: I changed the implementation to fetch shipping tax based on tax type (independent of shipment address and line items).