Menu

#14 ModalFormTester inteface change

open
nobody
None
5
2007-08-30
2007-08-30
Anonymous
No

Suggest changing ModalFormTester interface. Change "ExpectModal()" method to something like "RegisterModalFormHandler()". This method would no longer accept an "expected" bool. Also, replace "Verify()" with "Invoked()".

My argument is that all assertions should be done by NUnit's Assert utilities. The Verify() function performs a redundant assertion.

For example:
ModalFormTester modalTester = new ModalFormTester();
modalTester.ExpectModal("SomeMessageBox", "SomeHandler", false);
Assert.IsTrue(modalTester.Verify());

This could also be written as:
ModalFormTester modalTester = new ModalFormTester();
modalTester.ExpectModal("SomeMessageBox", "SomeHandler");
Assert.IsFalse(modalTester.Verify());

The redundancy is that Verify() asserts whether the expectations was met. Then Assert also checks that expectation.

This would be cleaner and there is one clear way to use it instead of two:
ModalFormTester modalTester = new ModalFormTester();
modalTester.ExpectModal("SomeMessageBox", "SomeHandler");
Assert.IsFalse(modalTester.Invoked());

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.