NUnit Testing with Xamarin

FionaCFionaC IEMember ✭✭

Hi,
So I'm looking to add a unit tests project to my Xamarin iOS solution. I added a Unit Test App to my solution with some simple tests just to see if it's working. This works fine and launches a 'Tests' app on to my device where I can run my tests.

My problem arises when I try to add a reference to my main project. I receive the following error:
"Could not register the assembly 'WinterfelliOS': error MT4118: Cannot register two managed types ('ProjectName.iOS.AppDelegate, ProjectName' and 'Tests.AppDelegate, Tests') with the same native name ('AppDelegate'). Tests"

So basically, how should I be setting up my tests project?

Tagged:

Best Answer

Answers

  • EmyMa341EmyMa341 USMember ✭✭

    Hi @FionaC , this problems seems to be common names of classes, are you using any 3rd party or some other library then try updating that library to latest version. Like I can see WinterfelliOS is an assembly which might be stored in a dll file you are targeting in your iOS project to use some functionality try updating that to latest version

  • FionaCFionaC IEMember ✭✭

    @MuhammadAmmadKhan said:
    Hi @FionaC , this problems seems to be common names of classes, are you using any 3rd party or some other library then try updating that library to latest version. Like I can see WinterfelliOS is an assembly which might be stored in a dll file you are targeting in your iOS project to use some functionality try updating that to latest version

    WinterfelliOS is the main project in my application. The only other project I have is the Test project. Both projects have AppDelegate classes in them. If I remove the AppDelegate from my Tests project, it's not going to run on the device.

  • gustaveracostagustaveracosta GBMember ✭✭

    @FionaC said:
    Apparently it's totally ok, to rename your AppDelegate class to something else - once it's registered with the new name and the Main.cs uses the new name also. No conflicting AppDelegates and it all works grand.

    Works for me!

Sign In or Register to comment.