TLDR: How do I create an Nunit project to test an iOS Library Project? I tried using an iOS Unit Test Project but I am unable to reference the iOS Library Project due to some sort of "Incompatible target framework" issue.
I am making a set of 3 libraries to be shared across multiple projects we are working on. To that end I have made:
MyCompany.Core - PCL Project with Xamarin.Forms package
MyCompany.iOS - iOS Library Project with Xamarin.Forms package. Has iOS specific implementations of MyCompany.Core interfaces.
MyCompany.Android - Android Library Project with Xamarin.Forms package. Has Android specific implementations of MyCompany.Core interfaces.
In order to test these, I've also created NUnit projects for each of the libraries (MyCompany.Core.Test, MyCompany.iOS.Test, MyCompany.Android.Test). MyCompany.Core.Test works as expected without issue. The issue is with the platform specific libraries. I will focus on iOS for simplicity. I created the MyCompany.iOS.Test project using the built-in template in Xamarin Studio: "Add->Add New Project->iOS->Classic API->iOS Unit Tests Project" The problem is that there seems to be some sort of target platform conflict that prevents me from adding a reference to MyCompany.iOS from MyCompany.iOS.Test so I cannot access any of the classes in order to test them.
When I go to "Edit References" in my test project, the checkbox to add the MyCompany.iOS library is grayed out and it says: "(Incompatible target framework: MonoTouch, Version=v1.0)"
I find this odd since if I create a standard iOS app ("Add->Add New Project->iOS->Classic API->iPhone->Empty Project", I can reference MyCompany.iOS without issue.
I also noticed that even though I was adding the same Xamarin.Forms package from nuget, in the case creating a regular project, references to Xamarin.Forms.Core, Xamarin.Forms.Xaml, and Xamarin.Forms.Platform.iOS get created. In the case of the iOS Unit Test Project, only Xamarin.Forms.Core and Xamarin.Forms.Xaml get created. Xamarin.Forms.Platform.iOS is not referenced. This will also be an issue since I do make use of some of the classes in Xamarin.Forms.Platform.iOS in the library I'm trying to test.
Any clues what is going on here? Any suggestions for setting up a unit test project for a Xamarin.Forms platform specific library?
Thanks!