February 13, 2008

Incompatibility among Framework’s build versions and problems with Rhino.Mocks

Filed under: .NET, C#, TDD, Rhino Mocks

I’ve written some mocking tests for my actual project lately. These tests use library Rhino.Mocks 3.3.0.906. The project is compiled and runs under .NET 2.0. I noticed today that some tests run failed on developers machine with Vista as operation system. There has been some difference between frameworks. My developer station with Windows XP on board had .NET 2.0.50727.1433  but Vista station had 2.0.50727.312

I’ve written some tests after error analysis. I’ll try to prove an error.

   1: public interface IMyInterface
   2: {
   3:     T GetTypedValue<T>(string key);
   4: }
   5:  
   6: [Test("Test which is correct for Framework 2.0.50727.312 + RhinoMock 3.3.")]
   7: public void TestWithStringTypeAndIgnoredArguments()
   8: {
   9:     MockRepository mocks = new MockRepository();
  10:     IMyInterface service = mocks.CreateMock<IMyInterface>();
  11:  
  12:     Expect
  13:         .Call(service.GetTypedValue<string>("any2"))
  14:         .IgnoreArguments()
  15:         .Return(null);
  16:  
  17:     mocks.ReplayAll();
  18:  
  19:     service.GetTypedValue<string>("my attribute2");
  20:  
  21:     mocks.VerifyAll();
  22: }
  23: [Test("Test which is correct for Framework 2.0.50727.312 + RhinoMock 3.3.")]
  24: public void TestWithStringTypeAndSpecifiedArguments()
  25: {
  26:     MockRepository mocks = new MockRepository();
  27:     IMyInterface service = mocks.CreateMock<IMyInterface>();
  28:  
  29:     Expect
  30:         .Call(service.GetTypedValue<string>("any2"))
  31:         .Return(null);
  32:  
  33:     mocks.ReplayAll();
  34:  
  35:     service.GetTypedValue<string>("any2");
  36:  
  37:     mocks.VerifyAll();
  38: }

These tests above runs correctly for both NET framework versions, 2.0.50727.1433 and 2.0.50727.312 .

Two next tests are quite similar. The only difference is type for generic method "GetTypedValue", "bool?" instead of "string".

   1: [Test("Test proves error for Framework 2.0.50727.312 + RhinoMock 3.3.")]
   2: public void TestWithNullableTypeAndIgnoredArguments()
   3: {
   4:     MockRepository mocks = new MockRepository();
   5:     IMyInterface service = mocks.CreateMock<IMyInterface>();
   6:  
   7:     Expect
   8:         .Call(service.GetTypedValue<bool?>("any2"))
   9:         .IgnoreArguments()
  10:         .Return(null);
  11:  
  12:     mocks.ReplayAll();
  13:  
  14:     service.GetTypedValue<bool?>("my attribute");
  15:  
  16:     mocks.VerifyAll();
  17: }
  18:  
  19: [Test("Test which is correct for Framework 2.0.50727.312 + RhinoMock 3.3.")]
  20: public void TestWithNullableTypeAndSpecifiedArguments()
  21: {
  22:     MockRepository mocks = new MockRepository();
  23:     IMyInterface service = mocks.CreateMock<IMyInterface>();
  24:  
  25:     Expect
  26:         .Call(service.GetTypedValue<bool?>("any2"))
  27:         .Return(null);
  28:  
  29:     mocks.ReplayAll();
  30:  
  31:     service.GetTypedValue<bool?>("any2");
  32:  
  33:     mocks.VerifyAll();
  34: }

Second test works correctly but first one has problem with arguments for expected call. IgnoreArguments method in line (9) doesn’t make this call to ignore arguments anymore. It will start working after installing  NET 3.5 on Vista which upgrades also NET 2.0 to version 2.0.50727.1433.

As you can see, little differences in build version can mess a lot.

January 1, 2008

Blog resurrection

Filed under: .NET

Happy new year 2008. One of promises for myself is to resurrect this blog :). But this time it will be about programming in C# and so on. Sorry for no more graphics, kit templates and tutorials :(. In fact I have totally no time for that anymore. I’m fully involved in some project in C# and I would like to share my knowledge about it from now. I hope that it will be interesting for all of you …

January 12, 2006

3GT Kit Gimp Tutorial - in English

Maybe some of you know that I’ve made 3GT kit creation tutorial for Gimp some time ago. Unfortunately it was written in Polish. I’ve found some free time finally and I have translated it in English. :) I’ve made only partial translation … but don’t worry it will be fully in English very soon :).

Tutorial: 3GT Kit Gimp Tutorial - in English

Have a nice reading.

January 7, 2006

3GT CONMEBOL National Kits

Filed under: FM Graphics

Here is my lastest 3GT Kit pack.

Download File

Have a nice watching kits in FM :)

December 30, 2005

FMaker 0.9.0 - Facepack Maker - First public beta

I have decided to release for public my first external beta util for Football Manager with best wishes of Happy New Year 2006 :).

FMaker, its full name is Facepack Maker, is a tool for automatic creation config.xml file. It just tries to parse names of png image files and matches them with names from database files. Then it extracts ID’s and creates config.xml file.

Here is a screen example, click to enlarge …

As you can see in this example “kowalski.png” was matched for 10 players and John Doe wasn’t matched to anyone. The rest of 24 players was matched correctly. This is part of output config.xml file.

<record from=”jakub_gronowski” to=”graphics/pictures/person/720373/portrait”/>
<record from=”jakub_kawa” to=”graphics/pictures/person/720376/portrait”/>
<record from=”kowalski” to=”graphics/pictures/person/710581/portrait”/>
<!– Person Name: Artur Kowalski 1971-11-04  -   ID: 710581 –>
<!– Person Name: Radoslaw Kowalski 1980-04-12  -   ID: 718009 –>
<!– Person Name: Bartlomiej Kowalski 1983-06-07  -   ID: 720004 –>
<!– Person Name: Ireneusz Kowalski 1979-03-17  -   ID: 711743 –>
<!– Person Name: Jacek Kowalski 1953-10-03  -   ID: 718114 –>
<!– Person Name: Pawel Kowalski 1937-02-10  -   ID: 713811 –>
<!– Person Name: Lukasz Kowalski 1980-12-01  -   ID: 712223 –>
<!– Person Name: Marek Kowalski 1984-04-25  -   ID: 720378 –>
<!– Person Name: Lukasz Kowalski 1981-02-22  -   ID: 714473 –>
<!– Person Name: Grzegorz Kowalski 1963-09-06  -   ID: 714358 –>
<record from=”krzysztof_brede” to=”graphics/pictures/person/711520/portrait”/>
<record from=”krzysztof_leszek” to=”graphics/pictures/person/720379/portrait”/>

If image is matched for more players it has to be renamed more accurate ex. jacek_kowalski.png. More info is in ReadMe files.

FMaker can also create config.xml for club, competition and nation logos and also for club and nation kits.

Download FMaker 0.9.0

FMaker 0.9.0 is first public beta release and it is compatible with original Football Manager 6.0.2 databases. To run FMaker you need to have Microsoft .NET Framework 1.1 installed. It can be downloaded from Windows Update or as Redistributable Package.

My future ideas for FMaker:

  • Compatibility with customized databases
  • Windows GUI version
  • Recursive directories
  • Sorting directories and manages them for ex. clubs
  • Searching for ID’s
  • Exporting player list for clubs
  • Mac version

Now I’m waiting for any comments and ideas from you.

«« Older Items •  Newer Items »»

Get free blog up and running in minutes with Blogsome | Theme designs available here