| Greg's profileGreg Olsen - Yellow Duck...PhotosBlogLists | Help |
|
October 23 Microsoft Dynamics CRM 3.0 Exam - I Passed!I have completed a project just recently with Microsoft Dynamics CRM 3.0 integrating with Microsoft Dynamics Nav 5. It was a great learning experience project. So once this completed I thought I should study and sit the Microsoft Dynamics CRM 3.0 Customisation Exam (MB2-422) - so I did! With a bit of study, I passed the exam today with a result of 94%. There are 70 questions, 2 hours to complete the exam (this info is public). I would love to tell you more but I signed a NDA (Non-Disclosure Agreement) so I can not release anything more about the exam itself. I have also gained the title of: Microsoft Certified Business Management Solutions Specialist by passing this exam. Gee that's a mouthful aye. If you study hard you will succeed in this exam. I encourage anyone working with MS CRM to have a go. CRM 4.0 (Titan) is on its way for release so it's only time before I do an upgrade for this exam. If you wish to book an exam you can do so through Prometic via this link: http://www.prometric.com I have my eye on a few more exams to sit, so stay tuned. Yellow Duck Guy October 06 Rhino Mocks v3.2 - New SyntaxI have been using Rhino Mocks v3.2 with my current project and i'm finding it is a test mocking tool I can't live without! What is Rhino Mocks?
(http://ayende.com/projects/rhino-mocks.aspx ) One aspect I like (which is mentioned on the Rhino homepage) is the fact that Rhino uses typed objects not strings like the others i.e. NMock, TypeMock.Net. Having the objects typed means that the build/compiler process will catch any human error mistakes. If they are not typed i.e. in strings like "ICustomerView" then if they are spelt incorrect or used incorrectly then they will only "blow up" or throw exceptions on you at runtime, which wastes time - that's not really nice! Hence why I like Rhino. This post will demonstrate the new Rhino Mocking syntax in v3.2 which I think is getting really close the "English spoken behavior" for tests. What I mean by this is that I would like to see a block which illustrates my Expectations and another block which illustrates my Assertions allowing the Unit Test(s) to be easy read and understood. There is a blog post at e-TOBI.net which illustrates really nicely the different versions of usage for Rhino Mocking. Below is a few examples from this site demonstrating the older syntax versions: Example using "Replay All" (Expectations) and "Verify All" (Assertions/Verifications)
MockRepository mocks = new MockRepository(); IDependency dependency = mocks.CreateMock<IDependency>();
// define expectations Expect.Call(dependency.GetSomething("parameter")).Return("result"); dependency.DoSomething(); mocks.ReplayAll();
// run test subject Subject subject = new Subject(dependency); subject.DoWork();
// verify expectations mocks.VerifyAll(); Example using "Record" (Expectations) and "Playback" (Assertions/Verifications) IDependency dependency = mocks.CreateMock<IDependency>();
using (mocks.Record()) { Expect.Call(dependency.GetSomething("parameter")).Return("result"); dependency.DoSomething(); }
using (mocks.Playback()) { Subject subject = new Subject(dependency); subject.DoWork(); } So when I analyse the above two versions I am left feeling confused by the syntax by what's actually happening. I have used both and they work just fine but I would rather have something that is more English readable or "English Fluent" as Rhino Mocks Website states. Example using the new syntax in v3.2
MockRepository mocks = new MockRepository(); IDependency dependency = mocks.CreateMock<IDependency>();
With.Mocks(mocks).Expecting(delegate { Expect.Call(dependency.GetSomething("parameter")).Return("result"); dependency.DoSomething(); }) .Verify(delegate { Subject subject = new Subject(dependency); subject.DoWork(); }); Below is a couple of Unit Test examples using the syntax from v3.2:
[Test] public void SendRemoteIPCallsSendRemoteIPFromService() { _remoteIPPresenter = new RemoteIPPresenter(_remoteIPView, _remoteIPService);
With.Mocks(_mockRepository).Expecting (delegate { _remoteIPService.SendRemoteIP(false); } ) .Verify (delegate { _remoteIPPresenter.SendRemoteIP(); } ); } [Test] public void RetrieveCurrentRemoteIPCallsRetrieveRemoteIPFromLocalAndDisplayRemoteIP() { _remoteIPPresenter = new RemoteIPPresenter(_remoteIPView, _remoteIPService);
With.Mocks(_mockRepository).Expecting (delegate { RemoteIP remoteIP = new RemoteIP("125.13.23.3", DateTime.Now); Expect.Call(_remoteIPService.RetrieveRemoteIPFromLocal()).Return(remoteIP); _remoteIPView.DisplayRemoteIP(remoteIP.IPAddress, remoteIP.DateReceived); } ) .Verify (delegate { _remoteIPPresenter.RetrieveCurrentRemoteIP(); } );
} So I suggest you start using the syntax from v3.2. Rhino is certainly a mocking framework for .NET I would recommend to any developer. |
|
|