Can I use a real object that implements ToolsAPI's IOTAEditPosition in a DUnit test?

StackOverflow https://stackoverflow.com/questions/16726961

  •  30-05-2022
  •  | 
  •  

문제

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.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top