on my constructor, I put a checker if this feature is available or not, using prefetchable.
public ModelTypeMaint()
{
Helpers.PreferenceHelper.CheckFeatures();
}
Now, I have tried to run a unit test on this particular graph, unfortunately even though I’ve implemented a mock setup, It still reads the Prefetchable checker.
How do I bypass the prefetchable on the constructor?
Unit Test Code
private ModelTypeMaint PrepareGraph()
{
SetupEnableDisable<ModelTypeMaint>();
var graph = PXGraph.CreateInstance<ModelTypeMaint>();
return graph;
}
rFact]
public void Test_Description_ValidLength()
{
ModelTypeMaint graph = PrepareGraph();
ModelType type = (ModelType)graph.Cachesctypeof(ModelType)].Insert(new ModelType
{
ModelCD = "UT00001",
Description = "Model Type: UNIT 00001"
});
Assert.InRange(type.Description.Length, 5, 255);
}
Thank you.