<?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 MapView extent is null in unit test? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-extent-is-null-in-unit-test/m-p/1249178#M9303</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to automate testing of a series of tools in my ArcGIS Pro Add In. Several of them rely on an active MapView and it doesn't seem to initialize properly in the context of a unit test. For example, I'd like to confirm the MapView coordinates change when a combobox item is changed, zooming to a different map tile in a dataset. Following the regression example in the community samples, my test currently looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public async Task ZoomToMapTile_ChangesMapViewLocation()
{
    await _map.OpenViewAsync();
    MapView mapView = MapView.Active;
    double originXCoordinate = MapView.Active.Extent.Center.X;
    Mapping.ZoomToMapTile("004");
    double destinationXCoordinate = MapView.Active.Extent.Center.X;

    Assert.AreNotEqual(originXCoordinate, destinationXCoordinate);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running with breakpoints, I see the MapView populates the correct map properly, but many of the properties are null, and the IsReady property is false. Should I avoid this pattern for unit testing user controls? Is there any other way for me to automate testing?&lt;/P&gt;&lt;P&gt;Any suggestions or guidance is greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 18:30:44 GMT</pubDate>
    <dc:creator>succip</dc:creator>
    <dc:date>2023-01-18T18:30:44Z</dc:date>
    <item>
      <title>MapView extent is null in unit test?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-extent-is-null-in-unit-test/m-p/1249178#M9303</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to automate testing of a series of tools in my ArcGIS Pro Add In. Several of them rely on an active MapView and it doesn't seem to initialize properly in the context of a unit test. For example, I'd like to confirm the MapView coordinates change when a combobox item is changed, zooming to a different map tile in a dataset. Following the regression example in the community samples, my test currently looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public async Task ZoomToMapTile_ChangesMapViewLocation()
{
    await _map.OpenViewAsync();
    MapView mapView = MapView.Active;
    double originXCoordinate = MapView.Active.Extent.Center.X;
    Mapping.ZoomToMapTile("004");
    double destinationXCoordinate = MapView.Active.Extent.Center.X;

    Assert.AreNotEqual(originXCoordinate, destinationXCoordinate);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running with breakpoints, I see the MapView populates the correct map properly, but many of the properties are null, and the IsReady property is false. Should I avoid this pattern for unit testing user controls? Is there any other way for me to automate testing?&lt;/P&gt;&lt;P&gt;Any suggestions or guidance is greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 18:30:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-extent-is-null-in-unit-test/m-p/1249178#M9303</guid>
      <dc:creator>succip</dc:creator>
      <dc:date>2023-01-18T18:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: MapView extent is null in unit test?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-extent-is-null-in-unit-test/m-p/1250416#M9317</link>
      <description>&lt;P&gt;When running headless, Pro does not have a fully activated view so u cant rely on it for unit tests. To test functionality that requires a ("proper") active view u will need something like&amp;nbsp;&lt;A href="https://www.google.com/search?q=coded+ui+test+software" target="_self"&gt;CUIT, coded UI test&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 15:40:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-extent-is-null-in-unit-test/m-p/1250416#M9317</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2023-01-23T15:40:20Z</dc:date>
    </item>
  </channel>
</rss>

