This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
eventbrokertestability.html
51 lines (51 loc) · 1.88 KB
/
eventbrokertestability.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
layout: documentation
title: EventBroker
teaser: Decoupled eventing with automatic thread switching
navigation:
- name: Overview
link: eventbroker.html
- name: Tutorial
link: eventbrokertutorial.html
- name: Registration by Attribute
link: eventbrokerregistrationbyattribute.html
- name: Registration over Interface
link: eventbrokerregistrationoverinterface.html
- name: Registration by Registrar
link: eventbrokerregistrationbyregistrar.html
- name: Simplified Handler Methods
link: eventbrokersimplifiedhandlermethods.html
- name: Direct Interaction
link: eventbrokerdirectinteraction.html
- name: Handlers
link: eventbrokerhandlers.html
- name: Matchers
link: eventbrokermatchers.html
- name: Exception Handling
link: eventbrokerexceptionhandling.html
- name: Extensions
link: eventbrokerextensions.html
- name: Logging
link: eventbrokerlogging.html
- name: Testability
link: eventbrokertestability.html
- name: Tips and Tricks
link: eventbrokertipsandtricks.html
- name: Specifications
link: eventbrokerspecifications.html
---
<h2>Testability</h2>
<p>
Testing multi-threaded, loosly coupled systems is a big challenge.
Therefore the event broker supports you by providing infrastructure to make execution of events always synchronous.
There is no need for using signals or locks in your unit tests.
</p>
<p>
In your tests, simply create the event broker with the unit test factory:
</p>
<script type="syntaxhighlighter" class="brush: csharp"><![CDATA[
var eventBroker = new EventBroker(new UnitTestFactory());
]]></script>
<p>
This event broker will handle all events on the publisher thread. Therefore, when the unit tests finished execution, all handler methods were executed, too. There is no need to use signals to make sure that all code is executed before making any asserts.
</p>