
In .NET on March 4, 2009 by Sid
It is actually pretty easy to raise events using the latest release of NMock. You can basically use Expect.Once.On(bla).EventAdd(“SomeEvent”, Is.Anything) to specify that you expect an event handler to be added for “SomeEvent” event on bla object and fire that event using Fire.Event(“SomeEvent”).
Here’s an example, minus any domain noise, that demonstrates the whole thing.
Read More »

In .NET on February 13, 2009 by Sid
What will happen when the following piece of code is compiled?
class Program
{
static void Main(string[] args)
{
ICanMove monkey = new Monkey();
monkey.Move();
}
}
public interface ICanMove
{
void Move();
}
public partial class Monkey : ICanMove
{
}
public partial class Monkey
{
public void Move()
{
Console.WriteLine(“Moved”);
}
}
Options:
- Compiler error.
- “Moved” will be printed.
Read More »