Hi,
In Unit Test Framework can we fetch values from DB or using PXSelect Query for Table.
I am getting null object when i use PXSelect in unit test framework
Thanks.
Best answer by Dmitrii Naumov
View originalHi,
In Unit Test Framework can we fetch values from DB or using PXSelect Query for Table.
I am getting null object when i use PXSelect in unit test framework
Thanks.
Best answer by Dmitrii Naumov
View original
Instead, in the unit tests you should prepare all the data you need in the code of the test itself.
E.g. see here:
https://github.com/Acumatica/UnitTestExamples/blob/master/UnitTestsDemo/Tests/CATransferTest.cs
We need to have a cashaccount for this test. So we just insert it in the cache:
graph.Caches[typeof(CashAccount)].Insert(
new CashAccount {
CashAccountCD = "102000",
CuryID = "USD"
});
After that we can use PXSelect<CashAccount>.Select(graph) and it will return the inserted cashaccount form the cache.
Hi Dmitrii
Simple use case:
e.g. Can I pass AACUSTOMER as Input in Sales Order, extract the Payment Terms from DB and for the given Order Type only Prepayment is allowed and hence if any other Payment Term is defaulted then I would like to Fail the test
Use Case is we will pass Part of the Input but we would like to extract from DB based on the 1st set of Input and compare for the Results
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.