Visual Studio 2017 has a new feature called Live Unit Testing. Live Unit Testing is currently in the Enterprise edition of Visual Studio 2017 and it’s available for C# and VB projects that target the .NET Framework. This Live Unit Testing automatically runs the impacted unit tests in the background as we edit code, and visualizes the results and code coverage live, in the editor, in real-time.
In this blog, we will discuss how Live Unit Test in Visual Studio 2017 works.
How to start Live Unit Testing
Enabling Live Unit Testing is as simple as going to the Test command at the top-level menu bar and starting it as shown in image below.
Live Unit Testing works with three popular unit testing frameworks: MSTest, xUnit and NUnit. When using these, we will need to ensure that the adapters and frameworks meet or exceed the minimum versions given below:
- For xUnit we will need xunit.runner.visualstudio version 2.2.0-beta3-build1187 and xunit 2.0 (or higher versions)
- For NUnit we will need NUnit3TestAdapter version 3.5.1 and NUnit version 3.5.0 (or higher versions)
- For MSTest we will need MSTest.TestAdapter 1.1.4-preview and MSTest.TestFramework 1.0.5-preview (or higher versions)
Live Unit Testing experience
Once we enabled Live Unit Test, its helps us to quickly see whether the code we are writing is covered and if the tests that covers it are passing, without leaving the editor. Unit test results and coverage visualizations appear on a line-by-line basis in the code editor as shown in sample image below:
Note: The dash indicates that the code does not have any test coverage. The red X signifies the line was executed by at least one unit test and failed. The green check mark signifies that the code was executed and any tests that ran, passed.
The live feedback also serves to notify us instantly if thee change has broken the program – if inline visualizations shift from green “✓”s to red “×”s, we know we broke one or more tests.
At any point in time we can hover over the “✓” or “×” to see how many tests are hitting the given line as seen in image below.
We can click on the check or “×” to see what tests are hitting the given line as shown in image below.
When hovering over the failed test in the tool tip, it expands to provide additional info to give more insight into the failure as shown in image below.
At any time, we can temporarily pause or completely stop live unit testing; for example, when we are in the middle of a refactoring and we know that our tests will be broken for a while. It is as simple as going to the Test command in top level menu bar and clicking the desired action, as shown below.
Live Unit Testing will improve our developer productivity, test coverage and quality of software.
The post Getting started with Live Unit Testing in Visual Studio 2017 appeared first on BizTalk360.
The Integration Account is part of the Logic Apps Enterprise Integration Pack (EIP) and is a secure, manageable and scalable container for the integration artifacts that we create. We can store maps, schemas, partners, agreements and certificates in our Integration Account once and reference them across all our logic apps making the creation of B2B processes with logic apps quick and easy.
Why should we use Enterprise Integration Pack?
- we are able to store all our artifacts in one place, which is our integration account.
- we can leverage the Logic Apps engine and all its connectors to build B2B workflows and integrate with 3rd party SaaS applications, on-premises apps as well as custom applications
- we can also leverage Azure functions
In this blog, we will discuss how we can connect Azure Logic Apps with an Integration Account.
Use Case Scenario
Let’s assume organizations want to exchange messages electronically, even if they use different protocols and formats. the Enterprise Integration Pack enables you to transform different formats into a format that organizations’ systems can interpret and process. Organizations can exchange messages through industry-standard protocols, including AS2, X12, and EDIFACT. You can also secure messages with both encryption and digital signatures.
If you are familiar with BizTalk Server or Microsoft Azure BizTalk Services, the Enterprise Integration features are easy to use because most concepts are similar. One major difference is that Enterprise Integration Pack uses Integration Accounts to simplify the storage and management of artifacts used in B2B communications.
Create an Integration Account
In Azure Portal, and Click “+NEW” and choose “Enterprise Integration”. Select “Integration Account”.
In the Create Integration Account blade, enter the Name for our Integration Account, select the Subscription we want to use; either create a new Resource group or select an existing Resource Group, select a Location where our Integration Account will be hosted, select a Pricing tier, then click the Create button.
The process usually takes within 1 minute. Once the template has been provisioned, we will see a notification and the new instances and related resources will appear in the “Resource groups” section of the Microsoft Azure management console.
Integration Account uses maps to transform XML data between formats. A map is an XML document that defines the data in a document that should be transformed into another format.
Select the Maps tile.
After the Maps blade opens, choose Add. Next, Enter a Name for our map. To upload the map file, choose the folder icon on the right side of the Map text box. After the upload process completes, choose OK.
Add a schema file smaller than 2 MB
In the Schemas blade that opens (from the preceding steps), choose Add.
Enter a Name for our schema. Upload the schema file by selecting the folder icon next to the Schema box. After the upload process completes, select OK.
How to link an integration account to a Logic app
Note: We must ensure our Integration Account and Logic app are in the same Azure location.
Select the Integration Account under Setting from our Logic app, we wish to link to our Logic App from the Select an Integration Account drop down list box and click Save Button.
We will see a notification that indicates that our Integration Account has been linked to our Logic app and that all artifacts in our Integration Account are now available to our Logic App.
Adding XML Validation
- Add a Request – When an HTTP request is received trigger our Logic App
- Add the XML Validation action, choose Add an action
- To filter all the actions to the one that we want, enter “xml” in the search box. Choose XML Validation
- To specify the XML content that we want to validate, select CONTENT.
- Select the body tag as the content that we want to validate.
Adding Transform XML
- Add the Transform XML action by first selecting Add an action
- Enter the word “transform” in the search box to filter all the actions to the one that we want to use
- Select the Transform XML action
- Add the XML CONTENT that you transform. We can use any XML data you receive in the HTTP request as the CONTENT. In this example, select the body of the HTTP request that triggered the Logic app
- Select the name of the Map that you want to use to perform the transformation. The map must already be in our Integration Account. In an earlier step, we already gave our Logic App access to our Integration Account that contains our map
Conditions are used to perform the action on which we add the condition when the condition matches the requirements.
Choose New Step (+) > Add an Condition.
@equals(xpath(xml(body(‘Transform_XML’)), ‘string(count(/.))’), ‘1’).
Once the Logic App is configured, it should look as shown below.
Run the Logic App
To test the Logic App, we will use Postman to send a request (POST) with a payload.
- Set content-type header to application/xml.
- Set request body to the content of sample-order.xml.
On successful execution, the Logic App will respond with the transformed message (a SAP order) in response body.
Integration Account stores all our artifacts in one place and references them across all our Logic Apps, making the creation of B2B processes with Logic Apps quick and easy. This is great for ROI because previously created BizTalk artifacts like schemas and maps can be re-used.