In ArcObjects .NET, everything has interfaces and can be mocked with modern lightweight mocking frameworks such as NSubstitute or FakeItEasy, allowing the developer to write
real unit tests in which the business logic can be tested in isolation (independent of any access to real ArcObjects resources). In the ArcGIS Pro SDK 1.1 and ArcGIS Runtime SDK .NET 10.2.6, this is practically impossible for several reasons:
- There are almost no interfaces.
- Many classes are sealed and/or have no virtual members and therefore cannot be faked (mocked).
- There are many static method calls.
With both SDKs, Esri wants to support the MVVM pattern in which the business logic resides in the view models and the classes that are spawned from them. One of the benefits of the MVVM pattern is that the business logic can be tested in isolation, independent of the UI. However, as long as the dependencies of Esri's SDKs cannot be faked, for the TDD community they will be useless.
We would like Esri to provide support for faking (mocking) their SDK objects so that developers can write tests that comply with the
FIRST principles and test only
their business logic.