<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1238412#M11516</link>
    <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;addingTargetFramework "net6.0-ios" to unit test project doesn't compile&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;The Visual Studio Test Explorer runs its tests on Windows, so you'll need to target Windows.&lt;BR /&gt;In order to run unit test on an iOS device, you need an actual application (as opposed to a class library) that knows how to discover and run tests inside that application project. Depending on which test framework you use, some of them might provide some APIs to help you do that (we ended up writing our own because we didn't find any that really worked well for our setup).&lt;/P&gt;</description>
    <pubDate>Tue, 06 Dec 2022 18:14:41 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2022-12-06T18:14:41Z</dc:date>
    <item>
      <title>Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1188497#M11112</link>
      <description>&lt;P&gt;Hi - we are updating an older Xamarin application (UWP, iOS) to Maui (Win UI/iOS) with the latest preview of ESRI. Everything converted fine with the exception of our unit tests. When we create a basic Maui application we are able to add Xunit tests without problem, but when we add in the latest ESRI packages we get the error&amp;nbsp;&lt;/P&gt;&lt;P&gt;Project '..{our app name}.csproj' targets 'net6.0;net6.0-windows10.0.194941.0.' it cannot be referenced by a project that targets '.NetCoreApp,version=v6.0'.&lt;/P&gt;&lt;P&gt;NU1201 Project {our app name} is not compatible with net6.0 (.NETCoreApp, Version=v6.0).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone had any luck with this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 21:38:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1188497#M11112</guid>
      <dc:creator>MeridithSpellerberg</dc:creator>
      <dc:date>2022-06-30T21:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1188544#M11113</link>
      <description>&lt;P&gt;The net6.0 target framework moniker (tfm) is only supported for class libraries. For unit tests you need to specify a platform specific tfm to run them on, or we have no way to deploy the required native runtime libraries for the correct OS.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 01:33:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1188544#M11113</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-07-01T01:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1234774#M11489</link>
      <description>&lt;P&gt;Hi ESRI,&lt;/P&gt;&lt;P&gt;We also have the same issue. It doesn't allow us to add Unit Test to our .NET MAUI Project due to this error: &lt;STRONG&gt;&lt;EM&gt;'Esri.ArcGISRuntime' nuget package cannot be used to target 'net6.0' ... Only platform-agnostic class libraries or Windows, iOS and Android platforms are supported.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We followed Microsoft's recommended UnitTest tutorial here: &lt;A href="https://youtu.be/C9vIDLQwc7M" target="_blank"&gt;https://youtu.be/C9vIDLQwc7M&lt;/A&gt;&lt;BR /&gt;The problem is that we have to add TargetFramework: net6.to .NET MAUI project in order to add it as a dependency to UnitTest project which targets net6.0.&lt;/P&gt;&lt;P&gt;It means we cannot add Unit Tests as long as we add&amp;nbsp;Esri.ArcGISRuntime.Maui to our .Net MAUI project. This seems to a big red flag for&amp;nbsp;Esri.ArcGISRuntime.Maui. Since Unit Test is essential to any project.&lt;/P&gt;&lt;P&gt;Can ESRI provide a solution to this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 23:58:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1234774#M11489</guid>
      <dc:creator>ChrisHu</dc:creator>
      <dc:date>2022-11-23T23:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1234794#M11490</link>
      <description>&lt;P&gt;The issue here is that ArcGIS Runtime is mainly a native library, and deploys runtimes for each OS it runs on. It's not possible to run that in a platform-agnostic way. It _must_ declare a target runtime in order to run. The good news though is that even unit tests runs on a specific OS with a specific runtime in the end.&lt;/P&gt;&lt;P&gt;There really shouldn't be an issue with you adding a target OS to your unit tests. If you for instance run your unit tests on Windows, just add the '-windows10.0.19041' to your target framework for your unit test project. In the video you linked to, the main project he's testing also have the OS declared in the targets, and there's nothing wrong with also doing this with the unit test project itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the video you posted, it's even pointed out the limited set of platforms you can run on:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dotMorten_esri_0-1670350823064.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57783iB58094F112FC6666/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dotMorten_esri_0-1670350823064.png" alt="dotMorten_esri_0-1670350823064.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 18:20:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1234794#M11490</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-12-06T18:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1234927#M11493</link>
      <description>&lt;P&gt;addingTargetFramework "net6.0-ios" to unit test project doesn't compile due to serveral errors. One reason is that&amp;nbsp; MAUI project produces Exe instead of Dll for TargetFramework&amp;nbsp;"net6.0-ios". You can't add Maui project as an project dependency to your unit test project.&amp;nbsp; Second reason is the unit test project throws compiler errors once you add&amp;nbsp;"net6.0-ios", now it want you to convert your unit test project to be an iOS project by adding bundleID and other stuff. Could you please provide a sample unit test project for .net MAUI with ESRI.ArcGISRuntime.Maui installed? I believe many people have the same problem when using&amp;nbsp;ESRI.ArcGISRuntime on .Net MAUI platform. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 21:17:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1234927#M11493</guid>
      <dc:creator>ChrisHu</dc:creator>
      <dc:date>2022-11-24T21:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1236648#M11505</link>
      <description>&lt;P&gt;I'm trying to get some unit tests going for a project using the 200.0-beta version of the Runtime. I tried this suggestion of targeting the net6.0-windows10.0.19041.0 framework in the test project and it builds, but unfortunately I am running into the issue described here when attempting to run the tests: &lt;A href="https://github.com/dotnet/maui/issues/11575" target="_blank"&gt;https://github.com/dotnet/maui/issues/11575&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If anyone has a suggestion to work around this it would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 22:53:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1236648#M11505</guid>
      <dc:creator>FelicityRhone</dc:creator>
      <dc:date>2022-11-30T22:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1238412#M11516</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;addingTargetFramework "net6.0-ios" to unit test project doesn't compile&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;The Visual Studio Test Explorer runs its tests on Windows, so you'll need to target Windows.&lt;BR /&gt;In order to run unit test on an iOS device, you need an actual application (as opposed to a class library) that knows how to discover and run tests inside that application project. Depending on which test framework you use, some of them might provide some APIs to help you do that (we ended up writing our own because we didn't find any that really worked well for our setup).&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 18:14:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1238412#M11516</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-12-06T18:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1238414#M11517</link>
      <description>&lt;P&gt;Yeah the problem you hit with Maui is it wants to build a packaged application, not a class library. Running unit tests against packaged applications is a lot trickier, and doesn't work well from within Visual Studio - I've only been able to do this from command line with some scripts (pretty much identical to how you'd do it with UWP from commandline).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.NET MAUI just isn't really in a great state today for unit testing, and we had to rely on a lot of home-built tooling to do it. My recommendation (for now at least) is to build a class library with your business logic that doesn't take a dependency on Maui itself (for most business logic you shouldn't have to), and run normal unit tests against that.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 18:18:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1238414#M11517</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-12-06T18:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1238445#M11518</link>
      <description>&lt;P&gt;Attached is an XUnit project that should work on Windows and Mac (didn't get a chance to run it on Mac, so might need a tweak or two)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dotMorten_esri_1-1670353594666.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57787i377E1AA7681957A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dotMorten_esri_1-1670353594666.png" alt="dotMorten_esri_1-1670353594666.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I did have an issue with setting &amp;lt;UseMaui&amp;gt;true&amp;lt;/UseMaui&amp;gt;, but I don't think that's really necessary since we're bringing that dependency in implicitly via the project reference.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 19:08:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1238445#M11518</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-12-06T19:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1239796#M11527</link>
      <description>&lt;P&gt;First of all, thank you for sharing this test project. I really appreciate your work!&lt;/P&gt;&lt;P&gt;There are two main issues here:&lt;/P&gt;&lt;P&gt;1. I ran the unit test on both Windows and Mac .&lt;/P&gt;&lt;P&gt;It throws this compiler error on Mac:&amp;nbsp;&lt;EM&gt;/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.4.471/tools/msbuild/iOS/Xamarin.Shared.targets(3,3): Error: A bundle identifier is required. Either add an 'ApplicationId' property in the project file, or add a 'CFBundleIdentifier' entry in the project's Info.plist file. (TestProject1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This is an issue I ran into before, as I mentioned in my previous comment.&lt;/P&gt;&lt;P&gt;2. Your unit test project works on Windows only when&amp;nbsp;&amp;lt;UseMaui&amp;gt;true&amp;lt;/UseMaui&amp;gt; is disabled. As you mentioned it in your comment that it breaks test run. It means we couldn't unit test any Maui API or Custom classes requires Maui API. It renders the unit test useless for a .Net Maui application.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 20:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1239796#M11527</guid>
      <dc:creator>ChrisHu</dc:creator>
      <dc:date>2022-12-09T20:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1239816#M11528</link>
      <description>&lt;P&gt;What you're really hitting here is a limitation of Microsoft's test framework. To fully run Maui, you need to run as a packaged app on Windows, as a Catalyst app on Mac, and as app packages on iOS and Android. Today TestExplorer does not support running test in this context, because it only supports using VSTest to call into a DLL and not talking to a separate application process (well it does for UWP... see below). The test project you were using and referring to in the window isn't running in the context of how the application will ultimately run (as a packaged / sandboxed app), but merely as a simple console app that the Test Explorer talks to.&lt;BR /&gt;&lt;BR /&gt;However to fully run MAUI and ArcGIS Runtime, you will need to run in the context of an application. We cannot run on Mac as a "normal" Mac console app - catalyst is required, and catalyst requires running as an application (sorry I forgot about this detail in my earlier reply). To put it another way: We don't support running on MacOS - we support running on MacCatalyst, and Microsoft's test runner does not today support that.&lt;/P&gt;&lt;P&gt;To run a unit test in the context of an application, you need a test runner application. I know Microsoft has their own they are using internally, and we've ported MSTest to iOS, Android and Catalyst to get around the same limitation (search for MSTestX on NuGet). I think XUnit has something as well here:&amp;nbsp;&lt;A href="https://github.com/shinyorg/xunit-maui" target="_blank"&gt;https://github.com/shinyorg/xunit-maui&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;TestExplorer has the capability to do this (this is how you run tests on UWP, as well as how we used to run unit tests on Windows Phone), but they haven't put in the work to support anything but UWP at this time.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 21:15:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unit-testing-maui-with-esri-100-14-0-preview2-with/m-p/1239816#M11528</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-12-09T21:15:22Z</dc:date>
    </item>
  </channel>
</rss>

