2010-05-17 134 views
0

我们在VS 2008(MSTest)中运行我们的单元测试的第一次出现Automapper错误。 “缺少类型映射配置或不支持的映射。抛出类型'AutoMapper.AutoMapperMappingException'的异常”Automapper错误我们第一次运行MSTest的单元测试

如果我们重新运行测试(“Run Checked Tests”),那么它们都会通过。这4个开发人员中只有2个出现这个问题。我们尝试在我们的“Bootstrapper”中添加一个超时,但这并不起作用。任何人遇到这个问题?

引导程序代码如下所示:

public static class AutoMapperConfiguration 
{ 
    public static bool IsConfigured { get; set; } 
    public static bool IsConfiguring { get; set; } 

    public static void Configure() 
    { 
     do 
     { 
      Thread.Sleep(10); 
     } while (IsConfiguring); 

     if (!IsConfigured) 
     { 
      IsConfiguring = true; 
      Mapper.Reset(); 
      Mapper.Initialize(x => x.AddProfile<DataContractProfile>()); 
      IsConfiguring = false; 
      IsConfigured = true; 
     } 

    } 
} 
+0

引导程序代码是什么样的? – 2010-05-17 14:25:22

回答

0

想出解决方案。我们在每个单元测试(Duh)中没有将IsConfigured设置为false。仍然不确定为什么它在某些机器上工作。