Reputation: 866
I'm having a bit of trouble showing a winform during a unit test. I'm using this as a user validated testing procedure to show the user 2 different image segments captured during Selenium UI testing and the diff between them and allowing the user to pass or fail the test based on whether or not the images are too different.
I've created the form with 2 PictureBox elements and added methods to the form to allow the form to take in the images I require and load them into the PictureBox and then show the form.
I've tried searching google + SO and I can't find any similar questions regarding this.
In my test I have:
var compareForm = new PlotCompare.PlotCompare();
compareForm.Add_Original_Image(image1);
compareForm.Add_Diff_Image(imageDiff);
compareForm.Show();
but the .Show();
call doesn't show the form.
The only issue I can reasonably think of is that the project I'm using is a class library because all it holds are tests and therefore doesn't have a main
function I can access.
Would appreciate any help, thanks in advance.
Upvotes: 1
Views: 1314
Reputation: 866
https://stackoverflow.com/a/34799721/3110529 Answered this, essentially setting the ShowInTaskbar
property of the form to False
it would show as expected!
I also had to use .ShowDialog()
rather than just .Show()
Upvotes: 3