Contents tagged with xUnit
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
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
today I want to share with you small explanation about how xUnit works.
Take a look at presented code:
[InlineData(3, 4, 5)]
[InlineData(7, 8, 9)]
public void MethodDemo(int numberOne, int numberTwo, int numberThree)
double data = new double;
data = new double;
data = numberOne;
data = numberTwo;
data = 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