1 module unit_threaded.ut.issues;
2 
3 import unit_threaded;
4 
5 
6 interface ICalcView {
7    @property string total();
8    @property void total(string t);
9 }
10 
11 class CalcController {
12     private ICalcView view;
13     this(ICalcView view) { this.view = view; }
14 
15     void onClick(int number) {
16         import std.conv: to;
17         view.total = number.to!string;
18     }
19 }
20 
21 
22 @("54")
23 unittest {
24    auto m = mock!ICalcView;
25    m.expect!"total"("42");
26 
27    auto ctrl = new CalcController(m);
28    ctrl.onClick(42);
29 
30    m.verify;
31 }
32 
33 
34 @("82")
35 unittest {
36 
37     import std.exception: assertThrown;
38 
39     static class A {
40         string x;
41 
42         override string toString() const {
43             return x;
44         }
45     }
46 
47     class B : A {}
48 
49     auto actual = new B;
50     auto expected = new B;
51 
52     actual.x = "foo";
53     expected.x = "bar";
54     assertThrown(actual.shouldEqual(expected));
55 }