| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| "http://www.w3.org/TR/html4/loose.dtd"> |
| |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>Tests</title> |
| <link rel="stylesheet" type="text/css" href="jsunit/css/jsUnitStyle.css"> |
| <script language="JavaScript" type="text/javascript" src="../../jsunit/app/jsUnitCore.js"></script> |
| <script language="JavaScript" type="text/javascript" src="..//mock4js.js"></script> |
| <script language="JavaScript" type="text/javascript" src="Publisher.js"></script> |
| <script language="JavaScript" type="text/javascript"> |
| |
| Mock4JS.addMockSupport(this); |
| |
| function setUp() { |
| Mock4JS.clearMocksToVerify(); |
| } |
| |
| function tearDown() { |
| Mock4JS.verifyAllMocks(); |
| } |
| |
| function testOneSubscriberReceivesAMessage() { |
| // setup |
| var mockSubscriber = mock(Subscriber); |
| var publisher = new Publisher(); |
| publisher.add(mockSubscriber.proxy()); |
| |
| var message = "message"; |
| |
| // expectations |
| mockSubscriber.expects(once()).receive(message); |
| |
| // execute |
| publisher.publish(message); |
| } |
| </script> |
| </head> |
| |
| <body> |
| <h1>JsUnit Tests</h1> |
| |
| <p>This page contains some JsUnit tests. To see them, take a look at the source.</p> |
| </body> |
| </html> |
| |