I have a class that I want to test the DialogResult value for. To get that type I need to add a reference to System.Windows.Forms.
Is it bad practice to have this included in a test project?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Include whatever you need for a unit test that can run without any human interaction, or the expectation that it is being observed.
If you wanted to see if something in the form showed up correctly then you are doing a functional test.
If you find that you have to do a lot of tests with forms then you may have too much business logic in your presentation layer (view layer) and you may want to move the business logic into a class that can be unit-tested separate from anything dealing with forms.
If you just need some enums or helper classes from Windows.Forms that doesn’t have to do with actually creating a form then a unit test for that is fine.