[Mono-list] Errormessage running Nunit on Mac Leopard

Ben Aurel ben.aurel at gmail.com
Tue May 6 07:05:52 EDT 2008


hi
I've built mono from sources on my Mac 10.5.2 which went fine (mostly I guess).
$ mcs HelloWorld.cs
$ mono HelloWolrd.exe
Hello World!

that went fine so far... Now I wanted to take it to the next step by
writing a simple nunit test: (sources from the nunit-site, see below):

$ mcs -t:library Account.cs [1]
$ mcs -pkg:dotnet -r:Nunit.Framework -r:Account -t:library AccountTest.cs [2]

$ nunit-console AccountTest.dll:
NUnit version 2.2.0
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A.
Vorontsov, Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.

OS Version: Unix 9.2.2.0    Mono Version: 1.1.4322.2032

.F

Tests run: 1, Failures: 1, Not run: 0, Time: 0.041441 seconds

Tests run: 1, Failures: 1, Not run: 0, Time: 0.041441 seconds

Failures:
1) bank.AccountTest.TransferFunds :
	expected:<250>
	 but was:<150>

and then a strange MESSAGE:

  at bank.AccountTest.TransferFunds () [0x00000]
  at (wrapper managed-to-native)
System.Reflection.MonoMethod:InternalInvoke
(object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00041] in ~/mono/compiling/mcs/class/corlib/System.Reflection/MonoMethod.cs:157

I don't think this reference to MonoMethod.cs:157 is normal. What is
wrong here?

Thanks in advance.
Ben

[1] Account.cs
  public class Account
  {
    private float balance;
    public void Deposit(float amount)
    {
      balance+=amount;
    }

    public void Withdraw(float amount)
    {
      balance-=amount;
    }

    public void TransferFunds(Account destination, float amount)
    {
    }

    public float Balance
    {
      get{ return balance;}
    }
  }
}


[2] AccountTest.cs
namespace bank
{
  using NUnit.Framework;

  [TestFixture]
  public class AccountTest
  {
    [Test]
    public void TransferFunds()
    {
      Account source = new Account();
      source.Deposit(200.00F);
      Account destination = new Account();
      destination.Deposit(150.00F);

      source.TransferFunds(destination, 100.00F);
      Assert.AreEqual(250.00F, destination.Balance);
      Assert.AreEqual(100.00F, source.Balance);
	
    }
  }


More information about the Mono-list mailing list