c# - Refactoring strategy for the class which generates specific text file -


I am not a TDD knot and I do not know how to solve the following problem. I have a large class that has a specific format Generates text file in, for importing into external systems, I am going to refine this class again and I want to write unit test first.

How should these tests look like? Actually the main goal - not to break the structure of the file. But does not it mean that I should compare the contents of the file before and after?

I think you will benefit from an exam that I will hesitate to call "Unit Test" Although arguably this current text-file-producer "unit" checks for it, it only has to differentiate between the current code and its output and a "golden master" file (which will run once you run the test and its designated place Can be generated by copying). If the code has a very conditional behavior, then you want to run it with multiple instances, each case of a separate test, with the existing code, by definition, all tests have to be passed.

Start Testing Now Find a method - or better, write a test for a method that you can remove, remove a true unit test - method, and make sure that all tests, new ones Pass the small system and still for the bigger system. Salted, rinse, repeat system testing gives you a protective deterrent which lets you confidently move forward in refactoring; Unit tests run the design of the new code.

The library is available to make such testing easier (though it is very easy without them). See.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -