How to translate C# 'readonly' keyword into D

Jacob Carlborg doob at me.com
Mon Feb 4 23:07:46 PST 2013


On 2013-02-04 14:35, o3o wrote:

> So, let me continue the example (I remove "const" for simplicity)...
> I would like check that bar.gun() call fun() function from IFoo
>
> unittest {
>       auto foo = new Mock<IFoo>(); //Will not compile.Mock doesn't (yet)
> exist
>       auto bar = new Bar(foo);
>       bar.gun();
>       foo.Received().fun(); // pass if 'fun' was called
> }
>
> void main() {}

The syntax for template instantiation is:

auto foo = new Mock!(IFoo)();

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list