Add abstract factory pattern code with unit test