# Maintain decoupled code

If you follow this approach, you avoid calling any static methods and program everything against an interface. Later, during the unit testing, you can mock the implementation all of the dependencies easily.

To create a unit test, use the following procedure:

1. Program against interface and move the static method call of the `SystemManager.SystemServices.IsReadOnly` method to a wrapper class.

   > success **EXAMPLE**: For more information, see `SystemManagerWrapper.cs` class in Sitefinity [documentation-samples](https://github.com/Sitefinity-SDK/documentation-samples) on GitHub.
2. Refactor the `IsDeletionAllowed` method.

   > success **EXAMPLE**: For more information, see `SutClass.cs` class in Sitefinity [documentation-samples](https://github.com/Sitefinity-SDK/documentation-samples) on GitHub.
3. Test the method by mocking the `ISystemManagerWrapper` using Telerik JustMock.

   > success **EXAMPLE**: For more information, see `SitefinityUnitTests.cs` class in Sitefinity [documentation-samples](https://github.com/Sitefinity-SDK/documentation-samples) on GitHub.
