{"action":"created","issue":{"url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/236","repository_url":"https://api.github.com/repos/nsubstitute/NSubstitute","labels_url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/236/comments","events_url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/236/events","html_url":"https://github.com/nsubstitute/NSubstitute/issues/236","id":162571038,"number":236,"title":"Portable Class Library support","user":{"login":"ghuntley","id":127353,"avatar_url":"https://avatars.githubusercontent.com/u/127353?v=3","gravatar_id":"","url":"https://api.github.com/users/ghuntley","html_url":"https://github.com/ghuntley","followers_url":"https://api.github.com/users/ghuntley/followers","following_url":"https://api.github.com/users/ghuntley/following{/other_user}","gists_url":"https://api.github.com/users/ghuntley/gists{/gist_id}","starred_url":"https://api.github.com/users/ghuntley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghuntley/subscriptions","organizations_url":"https://api.github.com/users/ghuntley/orgs","repos_url":"https://api.github.com/users/ghuntley/repos","events_url":"https://api.github.com/users/ghuntley/events{/privacy}","received_events_url":"https://api.github.com/users/ghuntley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-27T23:29:54Z","updated_at":"2016-09-19T15:37:35Z","closed_at":null,"body":"I use NSubstitue exclusively on the backend, love and recommend the library but have a minor bug-bear. When doing front-end Xamarin development I have to fall back on using [alternatives that involve generation via T4 templates](https://github.com/kentcb/PCLMock) (which has it's own issues as Xamarin Studio does not support T4). It would be fantastic to be able to use NSubstitue within a portable class library.\r\n\r\nA typical project layout in Xamarin land involves creating a `UnitTests` portable class library which is then consumed by a test harness application. Typically there are three platforms (iOS, Android and UWP) which execute the tests within `UnitTests` either in an emulator or on a physical device. A physical device is preferred as all platforms run some form of a linker over the code on release builds.\r\n\r\n- UnitTests (Profile 1111)\r\n- TestHarness.Droid (Xamarin Android App)\r\n- TestHarness.iOS (Xamarin iOS App)\r\n- TestHarness.UWP (Universal Windows App)\r\n\r\nHaving unit tests within the portable class library is the preferred route as it allows for a single project that contains all unit tests and prevents developers from sneaking in platform specific idioms etc. It is possible to use the project with Xamarin but at the cost of having to structure the codebase as follows which is super not-awesome.\r\n\r\n- UnitTests (Dummy 4.5 project)\r\n- UnitTests.Droid (File Linking to dummy project + Install NuGet Package)\r\n- UnitTests.iOS (File Linking to dummy project + Install NuGet Package)\r\n- UnitTests.UWP (File Linking to dummy project + Install NuGet Package)\r\n- TestHarness.Droid (Xamarin Android App)\r\n- TestHarness.iOS (Xamarin iOS App)\r\n- TestHarness.UWP (Universal Windows App)\r\n"},"comment":{"url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/comments/248029104","html_url":"https://github.com/nsubstitute/NSubstitute/issues/236#issuecomment-248029104","issue_url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/236","id":248029104,"user":{"login":"gtbuchanan","id":715687,"avatar_url":"https://avatars.githubusercontent.com/u/715687?v=3","gravatar_id":"","url":"https://api.github.com/users/gtbuchanan","html_url":"https://github.com/gtbuchanan","followers_url":"https://api.github.com/users/gtbuchanan/followers","following_url":"https://api.github.com/users/gtbuchanan/following{/other_user}","gists_url":"https://api.github.com/users/gtbuchanan/gists{/gist_id}","starred_url":"https://api.github.com/users/gtbuchanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtbuchanan/subscriptions","organizations_url":"https://api.github.com/users/gtbuchanan/orgs","repos_url":"https://api.github.com/users/gtbuchanan/repos","events_url":"https://api.github.com/users/gtbuchanan/events{/privacy}","received_events_url":"https://api.github.com/users/gtbuchanan/received_events","type":"User","site_admin":false},"created_at":"2016-09-19T15:37:35Z","updated_at":"2016-09-19T15:37:35Z","body":"After further review of the NSubstitute source, it seems support for iOS/UWP might be possible by implementing `IProxyFactory` for a static proxy library (such as [StaticProxy.Fody][0]) and using compiler flags to inject that proxy for iOS/UWP instead of `CastleDynamicProxyFactory`. It'd be great just to be able to plug in a reference to Fody in the iOS/UWP test projects without having to change any test code.\r\n\r\nUnfortunately, I don't have time to attempt to implement a pull request. Hopefully, someone will be able to come up with an elegant solution.\r\n\r\n[0]: https://github.com/BrunoJuchli/StaticProxy.Fody"}}
{"actor":{"display_login":"gtbuchanan"}}