Hi,
I am writing unit tests for a windows form named User. A picture box which is named as guiPictureBox is located int the form. I'm trying to write unit test for function UpdateGuiPictureBox (signature is private void UpdateGuiPictureBox()) which is loads a new picture to picturebox if a boolean value(named updateIndicator) is true. I tried to verify that if updateIndicator is false; guiPictureBox.Load() function is not called. I achieved to test it using ReflectiveMocks, but could not achieve it with AAA API. I would appreciate if you tell me what to do
My test code:
User user = new User();
ObjectState.GetField(user,"updateIndicator", false);
PictureBox pb = ObjectState.GetField(user, "guiPictureBox") as PictureBox;
Isolate.WhenCalled(() => pb.Load()).IgnoreCall();
Isolate.Invoke.Method(user, "UpdateGuiPictureBox");
Isolate.Verify.WasNotCalled(() => pb.Load()); ===============>Here I got Nested Call Exception was unhandled by user code error. I states "Verify doesn't support using a method call as an argument. To fix this pass null instead of PictureBox.ToString()"