Contents tagged with Shim

  • Unit test Acumatica PXGraph

    Hello everybody,

    today I want to make another description of how to cover with Unit Tests Graphs in Acumatica. 

    First of all I want to say that Acumatica controllers or as Acumatica names them graphs do not have any way to inject any dependency from interface. In such case it can be useful idea to use Microsoft Fakes library. 

    So in order to unit test Acumatica code you will have a need to make mix of Acumatica code with Microsoft shims. Imagine that you have following graph declaration:

    public class PAllocs : PXGraph<PaymentsAllocation>

    and somewhere in your graph you have method like this:

    [PXButton(Tooltip = "Saves values from grid")]

            [PXUIField(DisplayName = "Save" … more

  • Stubs vs Shims difference

    Hello everybody,

    today I want to mention difference between two kinds of testing. Shim vs Stub. 

    Take a look at the following code sample:

    // Stub sample

    public interface IDependency


        void SomeMethod();


    // Take note that class TestTarget allows to inject 

    // interface IDependency

    public class TestTarget


        private IDependency _dependency { get; set; }

        public TestTarget(IDependency dependency)


            _dependency = dependency;


        public void TestMethod()






    // Shim sample. Take note that class ShimTarget doesn't allow to inject 

    // interface as dependency

    public class Dep :  … more