Merge pull request #244 from vnitinv/unit-tests

Unit tests, coverage at 98%
factory/view up to 95%
Device unit tests 100%
Merge pull request #245 from shermdog/unit-tests

Unit tests up to 99% (14 lines missing)
UT with code coverage at 99.97% with just 3 lines missing