Contents tagged with xUnit

  • How to unit test SOOrderEntry extension in Acumatica

    Hello everybody,

    today I want to show to unit test, and I mean really unit test SOOrderEntry graph extnesion in Acumatica with XUnit.

    In order to achieve it, you'll need following steps:

    Create .Net Class library

    Reference xUnit

    Create public class that inherits from TestBase class

    Add override ResisterServices 

    Create something like PrepareGraph with usage of TestBase.Setup class

    Write your mehtods.

    I will not describe how steps 1 - 4 may look, as it is pretty obvious, but step 5 and 6 at C# level may look like this:

    public class SOOrderEntrySDExtTests : TestBase

    {

        protected IPXCurrencyService CurrencyService;

        protected IFinPeriodRepository FinPeriodService; … more

  • Some notes on xUnit usage

    Hello everybody,

    today I want to share with you small explanation about how xUnit works. 

    Take a look at presented code:

    [Theory]

    [InlineData(3, 4, 5)]

    [InlineData(7, 8, 9)]

    public void MethodDemo(int numberOne, int numberTwo, int numberThree)

    {

        double[][] data = new double[1][];

        data[0] = new double[3];

        data[0][0] = numberOne;

        data[0][1] = numberTwo;

        data[0][2] = numberThree;

        var sut = new Matrix(data);

    }

    If to describe this code in words, it has following meaning. 

    Attribute Theory says that it is test method which should be exeuted.

    Repeated twice Attribute InlineData says that method MethodDemo should be executed twice, with assigning to … more