Question

I'm writing a set of wizards to enhance source code editing in the IDE and the text manipulation is done through IOTAEditPosition which I get from BorlandIDEServices.

How can I automate tests against my methods so I can assert that the text manipulation was done right? IOTAEditPosition can't be stubbed or mocked because I would like to simulate the same environment of production code (the real IOTAEditPosition does some automatic work with indentation, line breaks, it has several methods like checking to see if a character is an identifier or a word separator, text search mechanisms and so on, it really does a lot of things that are specific to the IDE editor).

In this case, I don't care about puritanism like Unit vs Integration test. Call it integration test if you will, the fact is that my code totally depends and it's very sensible to the behavior of IOTAEditPosition and I need to test them together.

Just to make it a bit more clear. In my mind, the ideal assertion would be something like:

// DUnit test case
MyObject.LoadText(SampleText);
MyObject.ManipulateText;
CheckEquals(ExpectedManipulatedText, MyObject.GetManipulatedText);

As the actual underlying text manipulation is done by IOTAEditPosition, I need an implementation of it that behaves exactly like the one I get in production code.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top