{"id":8814,"date":"2015-04-29T14:07:00","date_gmt":"2015-04-29T14:07:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2015\/04\/29\/code-maps-now-differentiate-test-projects-and-bring-code-context-into-map-elements\/"},"modified":"2022-08-01T00:21:32","modified_gmt":"2022-08-01T08:21:32","slug":"code-maps-now-differentiate-test-projects-and-bring-code-context-into-map-elements","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/code-maps-now-differentiate-test-projects-and-bring-code-context-into-map-elements\/","title":{"rendered":"Code maps now differentiate test projects, and bring code context into map elements"},"content":{"rendered":"<p>Today <a href=\"http:\/\/blogs.msdn.com\/b\/somasegar\/\">Soma announced<\/a> the Release Candidate of Visual Studio 2015. It\u00a0adds two useful improvements to the Code Maps feature, which can make it easier to create better designs and architectures for your applications. The first improvement is in the way that code maps display and interpret test assets within solutions. The second improvement is in the way that the context of your code is carried through into the elements on the map.<\/p>\n<p>\u00a0<\/p>\n<h3><span style=\"color: #0000ff\">Test project differentiation<\/span><\/h3>\n<p>In Visual Studio 2103, test assets (such as test projects and classes) are displayed in exactly the same way as other types of code items. For example, the following screenshot shows the code map generated for a solution in Visual Studio 2013. To make it easier to see the contents, we used the Layout menu in the code map toolbar to show the map in Quick Clusters Layout.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/3362.image_thumb_634D1456.png\" alt=\"image\" width=\"490\" height=\"588\" border=\"0\" \/><\/p>\n<p>\u00a0<\/p>\n<p><em>This post demonstrates the <strong>\/\/build<\/strong> conference version of Visual Studio 2015. The UI and the menu commands are likely to have changed a little in the final release version.<\/em><\/p>\n<p>**<br \/>\nHowever, in Visual Studio 2015, code maps now differentiate test assets and display them with a new style. The following screenshot shows the same solution and layout in a Visual Studio 2015 code map. You can see the new style in the map and on the <strong>Legend<\/strong> panel.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/1070.image_thumb_67E84072.png\" alt=\"image\" width=\"599\" height=\"542\" border=\"0\" \/><\/p>\n<p>\u00a0<\/p>\n<p><em>Visual Studio automatically identifies Microsoft Test (MSTest) assets. It also identifies and categorizes as test assets any code from other test frameworks for which you have installed the respective adapters.<\/em><\/p>\n<p>\u00a0<\/p>\n<p>In addition, the <strong>Filters<\/strong> pane (shown by clicking the <strong>Filters<\/strong> button in the code maps toolbar) now contains a <strong>Test Assets<\/strong> checkbox that allows you to show or hide test items. This means you can quickly and easily simplify the map, and focus on specific items of interest.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/0576.image_thumb_7D6AA12F.png\" alt=\"image\" width=\"543\" height=\"532\" border=\"0\" \/><br \/>\n\u00a0<\/p>\n<h3><span style=\"color: #0000ff\">Code context improvements<\/span><\/h3>\n<p>The second improvement in this release of Visual Studio 2015 is the way that the context for code items is carried through into the code elements of a map. To see how this feature makes code maps more useful, the following example shows the difference between the experience in Visual Studio 2013 and Visual Studio 2015.<\/p>\n<p>In this example, we want to make a change to some code within our solution. The code we need to change is an enumeration called <strong>LinkStatus<\/strong>, and we want to know before we start what impact this change could have on the solution as a whole.<\/p>\n<h4>\u00a0<\/h4>\n<h4><span style=\"color: #0000ff\">The VS 2013 experience&#8230;<\/span><\/h4>\n<p>In Visual Studio 2103, the first step is to open the source code file and select the code element we want to change. Right clicking opens the context menu, and we can select <strong>Show on Code Map<\/strong>.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/2543.image16_thumb_52B457C1.png\" alt=\"image\" width=\"548\" height=\"497\" border=\"0\" \/><\/p>\n<p>Visual Studio shows a new code map containing just our <strong>LinkStatus<\/strong> enumeration item &#8211; notice that there is no context shown for this item. However, right clicking allows us to select** Find All References**, which will provide the information we need to see the impact a change will have on all the other code elements of the solution.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/0407.image21_thumb_2B12FCF9.png\" alt=\"image\" width=\"443\" height=\"316\" border=\"0\" \/><br \/>\n\u00a0<br \/>\nThe next screenshot shows the result. Despite the fact that we had to shrink the size to get it onto the page, you can see that it\u2019s clearly not very useful as it is.\u00a0<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/8625.image_thumb_053F6747.png\" alt=\"image\" width=\"1232\" height=\"65\" border=\"0\" \/><\/p>\n<p>And, even when we use the <strong>Quick Clusters Layout<\/strong> option on the <strong>Layout<\/strong> menu to get a better view of the contents, it\u2019s not that much clearer where all the possible impacts are. All we\u2019re seeing are the methods and properties where the <strong>LinkStatus<\/strong> enumeration is referenced.\u00a0\u00a0<br \/>\n\u00a0<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px\" title=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/6318.clip_image001_thumb_15DC8397.png\" alt=\"clip_image001\" width=\"302\" height=\"719\" border=\"0\" \/><\/p>\n<p>So we press <em>CTRL + A<\/em> to select all of the items on the map, right click, and choose <strong>Show All Containers.<\/strong><br \/>\n\u00a0<br \/>\n<img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/0474.image_thumb_5B862F17.png\" alt=\"image\" width=\"503\" height=\"560\" border=\"0\" \/><\/p>\n<p>Now, finally, we can see where the possibly impacts may occur in terms of the classes, namespaces, and assemblies.<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/1321.image_thumb_49CE469F.png\" alt=\"image\" width=\"523\" height=\"560\" border=\"0\" \/><\/p>\n<h3><span style=\"color: #0000ff\">The VS 2015 experience&#8230;<\/span><\/h3>\n<p>Instead, let\u2019s now see how much better the experience is in Visual Studio 2015. As before, we start by selecting the enumeration in the source code file, and showing it on a code map.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/0181.image_thumb_13823FF2.png\" alt=\"image\" width=\"454\" height=\"374\" border=\"0\" \/><\/p>\n<p>Notice that, this time, we get the context for the code element. As well as the <strong>LinkStatus<\/strong> node, we get the namespace and the assembly containers. From here we continue as before, by finding all references to our <strong>LinkStatus<\/strong> enumeration.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/1464.image_thumb_374088EE.png\" alt=\"image\" width=\"393\" height=\"226\" border=\"0\" \/><\/p>\n<p>\u00a0<\/p>\n<p>Visual Studio 2015 now displays a code map that contains all of the referencing code elements, each contained within its class, namespace, assembly, and solution folder. There is no need to go through the process of selecting them all and showing the containers, as we had to do in Visual Studio 2013.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/0638.image_thumb_1A5C857B.png\" alt=\"image\" width=\"477\" height=\"507\" border=\"0\" \/><\/p>\n<h3>\u00a0<\/h3>\n<h3><span style=\"color: #0000ff\">And there\u2019s more&#8230;<\/span><\/h3>\n<p>Just when you think it can\u2019t get any better, remember the first improvement in Visual Studio 2015 we saw earlier in this post. It\u2019s quite likely that, when we are initially modifying the code for a solution, we aren\u2019t that worried about whether we break the tests. After all, it\u2019s possible they will need to be updated afterwards to cover the changes to the code.<\/p>\n<p>By turning off display of test assets in the <strong>Filter<\/strong> pane, as you saw earlier, we remove some of the items in the map. This also removes all of the reference links to these items. It considerably simplifies our code map and makes it much easier to focus on the references to our <strong>LinkStatus<\/strong> enumeration in the actual application code \u2013 as you can see in this screenshot.<\/p>\n<p><img decoding=\"async\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/04\/1007.image_thumb_469E2DC1.png\" alt=\"image\" width=\"660\" height=\"480\" border=\"0\" \/><\/p>\n<p>\u00a0<\/p>\n<p>Compare this with the earlier screenshot from Visual Studio 2013 to see just how much the diagram has been simplified.<\/p>\n<h3><span style=\"color: #0000ff\">Related information<\/span><\/h3>\n<ul>\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2015\/02\/12\/new-ways-to-quickly-create-a-code-map.aspx\">New ways to quickly create a Code Map<\/a><\/li>\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2014\/11\/12\/filter-link-types-on-code-map.aspx\">Filter link types on Code Map<\/a><\/li>\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2015\/02\/23\/code-map-improvements-in-visual-studio-2015-ctp6.aspx\">Code Map improvements in Visual Studio 2015 CTP6<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dd409453(v=vs.140).aspx\">Map dependencies across your code<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Today Soma announced the Release Candidate of Visual Studio 2015. It\u00a0adds two useful improvements to the Code Maps feature, which can make it easier to create better designs and architectures for your applications. The first improvement is in the way that code maps display and interpret test assets within solutions. The second improvement is in [&hellip;]<\/p>\n","protected":false},"author":98,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,251],"tags":[],"class_list":["post-8814","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-security"],"acf":[],"blog_post_summary":"<p>Today Soma announced the Release Candidate of Visual Studio 2015. It\u00a0adds two useful improvements to the Code Maps feature, which can make it easier to create better designs and architectures for your applications. The first improvement is in the way that code maps display and interpret test assets within solutions. The second improvement is in [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/8814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/98"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=8814"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/8814\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=8814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=8814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=8814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}