1. File -> New -> Test with Moq
2. Select class to test (with nice Find etc., look at upcoming type
selector from Entlib)
3. Default naming convention: class name == [selected type]Fixture.cs
4. Generates starting point (no test framework attributes on class or
method, let the user add those manually):
public class FooFixture
{
public void TestFoo()
{
var dep1 = new Mock<IDep>();
var dep2 = new Mock<IDep2>();
var foo = new Foo(dep1.Object, dep2.Object);
// arrange/expect
// act
// assert/verify
}
}
5. Should do intelligent naming: if dependency is a class MyFoo, mock
variable should me named myFoo. if target object is named Foo, object
should be named foo, etc.
6. Would be VERY cool if we could infer at least ONE working Expect and ONE
Verify call, i.e.:
// arrange/expect
dep1.Expect(d => d.Save())
.Returns(true);
// act
// assert/verify
dep1.Verify(d => d.Save());
7. If there are more than 2 mocked dependencies, add the following comment
before instantiating the mocks:
// For consistency in behavior and verification across multiple mocks,
you might want to use MockFactory.
Original issue reported on code.google.com by kzu.net on 4 Jul 2008 at 8:25
Original issue reported on code.google.com by
kzu.net
on 4 Jul 2008 at 8:25