Your assumption is not correct. $f(z)$ is not continuous on the imaginary line and therefore is not holomorphic on the domain defined by $|z|<1$. This mean the integral is not necessarily $0$.
We can integrate the "regular" way (with parametrization). Let $z = e^{it}$ then
$$ \int_C f(z)\ dz = \int_{-\pi/2}^{\pi/2} e^{it}\ ie^{it}\ dt + \int_{\pi/2}^{3\pi/2} e^{2it}\ ie^{it}\ dt \\\ = \left.\frac{e^{2it}}{2}\right|_{-\pi/2}^{\pi/2} + \left.\frac{e^{3it}}{3}\right|_{\pi/2}^{3\pi/2} = \frac{2i}{3} $$
This is in fact consistent with your attempt, because $f(z)$ is still piecewise continuous, so the contour can be broken up into two pieces, both of which are path-independent.