Parse your XML with XPATH and find a value of an element based on the value of another element
When parsing and reading XML files in your C# code, you can use the XDocument or XElement objects to access it with LINQ and the Descendants or Elements properties. However, there is another option; you can use XPATH for traversing the XML. In this example we are going to see how you access a value of an XML-element, by matching the value of another element with a value given from the user.
How to create an empty or with one element IReadOnlyCollection for your unit-tests
When using the Moq framework for mocking your C# classes, you will have do define what dummy value or values a method of the mocked classes returns. For that we use the Setup method and in the Returns method we define the returned value. The question now is, which dummy value to return when your methods return a IReadOnlyCollection collection.
How to pass parameters to an AutoMapper Profile constructor aka Dependency Injection for AutoMapper
While using AutoMapper for mapping different objects in your application, you might encounter situations where you need business logic from other services during the mapping process. To handle this, you can inject these services into your Profile class.
How to fix the "Unable to find assembly Microsoft.VisualStudio.QualityTools.LoadTest ..." error when running your unit-tests
For an older MVC project I wrote unit-tests with the MSTest framework. Visual Studio requires a .testsettings file in your project, which contains the configuration for the unit-tests.
When running or debugging unit-tests there might be the case that the “Unable to find assembly Microsoft.VisualStudio.QualityTools.LoadTest …” error is logged and the test is getting skipped. In order to correct this issue you have to check inside the .testsettings file for the WebTestRunConfiguration section.
How to define and use Application Settings in your Azure Functions
As it is stated in the Azure Portal Application settings are encrypted at rest and transmitted over an encrypted channel. You can choose to display them in plain text in your browser by using the controls below. Application Settings are exposed as environment variables for access by your application at runtime.
Storing sensitive data as application settings is preferred over having them in plain text in your code. In this article we are going to see how to define them in your Azure Portal, how to integrate them in your Function-code and how to give them values when you are debugging your Functions locally.