Hi, I’m trying to create a unit test for my Extension Library, but retrieving a DAC Extension always returns null for some reason. I followed all the steps in T280 course but I still can’t get the DAC Extension. I am currently trying to create unit tests for version 22R1. Here is the code snippet:
using Xunit;
using PX.Data;
using PX.Tests.Unit;
using PX.Objects.CA;
using Custom.DAC;
using PX.Objects.GL;
namespace Customization.Tests
{
public class CashAccountMaintExtTest : TestBase
{
Fact]
public void TestingCashAccountExtension()
{
Setup<CashAccountMaint>(new GLSetup());
Setup<CashAccountMaint>(new CASetup());
var graph = PXGraph.CreateInstance<CashAccountMaint>();
CashAccount cashAccount = (CashAccount) graph.Cachesatypeof(CashAccount)].Insert(
new CashAccount
{
CashAccountCD = "Test"
}
);
//This always returns null
var cashAccountExt = cashAccount.GetExtension<CustomCashAccountExt>();
}
}
}