开发者

VS2010 + NUnit failing to load assemblies?

Im using VS2010, C# 4.0, NHibernate and NUnit in a project Im working on.. In doing database tests I've come across a wierd problem.. When I run my tests, nunit-agent.exe crashes for no apparent reason.. I've since then discovered that when i debug my tests, I get the following exception in the TestFixtureSetup method:

TypeInitializationException: The type initializer for 'NHibernate.ByteCode.Castle.ProxyFactory' threw an exception. Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc

Now, it seems to me that what it's looking for is identical to the one it found?

I've doublechecked and the assembly is referenced in the test project.. I have also tried readding the reference, but to no avail.. Any ideas?

UPDATE2: I tried changing the target framework to .net 3.5 of all my projects and now all tests fail with the error above..

UPDATE: Some tests works, others dont.. I have a customer class:

public class Customer : IEntity<string>
{
  private readonly string id;
  public virtual string Id
  {
    get { return id; }
  }

  public virtual string Name { get; set; }
  public virtual Address Address { get; se开发者_Go百科t; }
}

Where the tests runs perfectly fine.. However tests for my product class:

public class Product : IEntity<string>
{
  private readonly string id;

  public virtual string Name { get; set; }
  public virtual decimal Price { get; set; }

  public virtual string Id 
  {
    get { return Id; }
  }
}

Does not work (I get the exception from before).. And the funny thing is that tests for both classes uses the exact same base class that contains all the database access code..


I solved the problem.. It seems Nhibernate was looking for DynamicProxy 2.1.0 while I had referenced 2.1.1..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜