TDD in a text file import project

I’m just starting, and yes, I haven’t written any tests yet (I’m not a fundamentalist, I don’t like compilation errors just because there is no test), but I’m wondering where to start the project, which analyzes the records of flat files of a fixed length in accordance with XML mapping, into a class that is a superset of all file layouts before writing (with conversion) class information to a database table.

There are so many external factors, and I don’t want to make fun of them, so where and how would it be a good way to start the test managing this project?

+3
source share
3 answers

. :

  • /

, . , mocks/stubs .

+7

, IO:

  • , StreamReader Stream, . StringReader MemoryStream ​​ .
  • , . ( , ) Assembly.GetManifestResourceStream .

, TrueWill . , unit test , - , . , , .

+5

, , . , . , , , , .

. , , . , .

Mock Frameworks, . , , - . - .

If you decide to spend some time learning how to test using a layout, you can start with this article .

Good luck.

+1
source

Source: https://habr.com/ru/post/1718122/


All Articles