Added test for code example in #220. Modified count_affected property to cast input values to int.