I'm a C# programmer, when I apply IoC pattern I use readonly
keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx)
in this manner:
:// C# code
:interface IFoo {
: void Fun();
:}
:
:class Foo: IFoo {
: void Fun() {...}
:}
:class Bar {
: private readonly IFoo foo;
:
On Monday, 4 February 2013 at 09:02:31 UTC, o3o wrote:
I'm a C# programmer, when I apply IoC pattern I use readonly
keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx)
in this manner:
:// C# code
:interface IFoo {
: void Fun();
:}
:
:class Foo: IFoo {
: void Fun()
On Monday, 4 February 2013 at 10:26:55 UTC, simendsjo wrote:
On Monday, 4 February 2013 at 09:02:31 UTC, o3o wrote:
I'm a C# programmer, when I apply IoC pattern I use
readonly keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx)
in this manner:
:// C# code
On 2013-02-04 10:02, o3o wrote:
I'm a C# programmer, when I apply IoC pattern I use readonly keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx) in
this manner:
:// C# code
:interface IFoo {
: void Fun();
:}
:
:class Foo: IFoo {
: void Fun() {...}
:}
:class Bar {
:
On Monday, 4 February 2013 at 10:26:55 UTC, simendsjo wrote:
[cut]
So.. Every method you call through a const instance must also
be const, otherwise you have the ability to change something
that should be a constant.
Thanks simendsjo, now I get it...
So, let me continue the example (I remove
First, AFAIK, there is no equivalent of C# readonly in D,
despite the fact that D uses 3 keywords for various kinds of
immutability.
Second, here you can find a mocking library for D:
http://www.dsource.org/projects/dmocks/wiki/DMocks
On Monday, 4 February 2013 at 13:35:24 UTC, o3o
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 MockIFoo(); //Will not compile.Mock doesn't (yet)
exist
auto bar = new Bar(foo);