I am trying to create a system test for an old code base where there is no interfaces and most functions are private. The application gets data from another system, transforms it to a "better format" and saves it to a cache.
I want to read the value that is about to be written to the database and then skip the write step.
I have however found a function that returns the value I need.:
public virtual List<string> MyFunction(XmlDocument input)
{
var x = DoSomethingWithInput();
return x;
}
So my question is, is there any mocking method (with NSubstitute, Moq, or others) that let me read the return value? I have mostly seen reading inputs and replacing outputs.
The return value I get from this function will be compared to my expected value. But since there is a lot of code before this function I can't just run this function, I need to run the entire application but halt it here.
The class that writes to the database is using static functions only so no possibility to mock that and get the input there as far as I know.