简体   繁体   中英

VS2008 Unit Test Project bugs

I'm using VS 2008 Developer Edition and am finding some bugs with the Test Projects.

I am getting one error that doesn't make sense - I have a class called 'Foo' which I need to test and created the blank test class automatically.

Foo takes 3 paremeters in its constructor - IBar, IBaz, IBang.

When I write a test case, I will Dim foo as New Foo(bar,baz,bang), and I will sometimes get an error that says = 'Type IBang could not be implicitly converted to IBang'. This error does not make any sense.

Even more odd - if I switch to an instance of Foo_Accessor() instead, the error goes away. I've played with the references and then I can eventually fix the above error - but then I get the same error for my Foo_Accessor() class!

I clean, rebuild, and sometimes the error will go away - but then I get the error 'Foo_Accessor' is not defined. Now I go to the Foo class and do 'create accessor' again - again, it still gives the same error. So at this point I'm stuck and my solution won't compile, and the only thing I did was add a new test case through visual studio!

Has anyone seen these issues and could please help?

Also - I have tried everything, including instructions from MS such as - renaming the type, re-referencing the project / in different ways, unloading the projects, etc, etc.. still I wind up with either the 'ifoo cannot convert to ifoo' bug or Foo_Accessor is not defined bug... I'm about to just break down and give the damned property I have to check a ReadOnly accessor... !

It's hard to say for certain but it sounds like you have a problem with your references being setup incorrectly. What's likely happening here is that one of the references between your projects is setup as a DLL reference vs. a project reference. This can confuse the type system into thinking that Bang from the project and Bang from the DLL are actually different types.

I would delete all references between my projects. Then go add all of them back again being careful to select the project from the project tab of the add reference dialog vs. the Browse one. This should fix your problem.

Is this a multi-language project or just a single language project? I've found this type of problem is more likely to occur in a multi-language project but it's certainly happened in a single language one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM