locked
Refactor for Unit Tests RRS feed

  • Question

  • I'm running CTP 7 right now. Question around Rename/Refactor. I have a unit test that tests a stored procedure. I used refactor to change a column. Refactor finds and changes all instances of the column name, except my Unit Test. I thought I heard/read that refactoring does change Unit Tests also. Can you give me a quick update on how refactor works related to Unit Tests?

    BTW, my Unit Tests run perfectly, since they are only calling my SP.

    Thank you.

    Randy

    Sunday, November 26, 2006 2:03 PM

Answers

  • You should be able to run refactor into your unit tests in CTP7.

    Within the Refactor Preview dialog you will see the changes that will be applied to the unit tests however we do not change the unit tests by default so you need to ensure that you have the unit tests checkbox checked to refactor into the unit tests.

     

    Let me know if that fixes your issue

     

    mairead

    PM, TS Data

    Monday, November 27, 2006 8:12 PM

All replies

  • You should be able to run refactor into your unit tests in CTP7.

    Within the Refactor Preview dialog you will see the changes that will be applied to the unit tests however we do not change the unit tests by default so you need to ensure that you have the unit tests checkbox checked to refactor into the unit tests.

     

    Let me know if that fixes your issue

     

    mairead

    PM, TS Data

    Monday, November 27, 2006 8:12 PM
  • Yes, Mairead is correct – we do not refactor into the unit testing .resx files be default. 

     

    It is important to note that when you do refactor unit tests you are modifying the TSql in the tests not the C#/VB code; the TSql is stored in the .resx file for the test class.  If you have the designer open when you do a refactor you will need to close and reopen the designer to see the changes.  If you designer is dirty before you do a refactor it is okay to save your changes after completing the refactor, your changes and the refactored changes will be visible when you reopen the designer.

    Wednesday, November 29, 2006 10:38 PM
  • This makes total sense. I did'nt know that Unit Tests have to be "checked" in order for refactor to work on them. I'll give that a try.

    Thanks Mairead and J.D. Laflen

    Wednesday, December 6, 2006 3:10 AM