Posts

Showing posts from January, 2019

Word Cloud Generator

Take the trace of the frequency from the log and throw it to this Word Cloud Generator to find the areas of interest that with the most value. (80/20 - Pareto)

https://www.jasondavies.com/wordcloud/

Exploring the Options for Filtering which Tests to run using VSTest.console.exe

//Run Tests with /Tests NAME: World vstest.console.exe ProjectTests.dll /Tests:World
//Run Tests with /Tests NAME:SetStatus vstest.console.exe ProjectTests.dll /Tests:SetStatus
//Run Tests with /TestCaseFilter Priority: 1 vstest.console.exe ProjectTests.dll /TestCaseFilter:"Priority=1"
//Run Tests with /TestCaseFilter Priority: 2 vstest.console.exe ProjectTests.dll /TestCaseFilter:"Priority=2"
//Run Tests with TestCategory: Cell vstest.console.exe ProjectTests.dll /TestCaseFilter:"TestCategory=Cell"
//Run Tests with TestCategory: World vstest.console.exe ProjectTests.dll /TestCaseFilter:"TestCategory=World"
//List Available Loggers vstest.console.exe /listloggers
//Use a Loggers vstest.console.exe ProjectTests.dll /logger:Trx

Using TestCategory with OpenCover and ReportGenerator with VSTest.console.exe

As we know we can use the TestCategory Attribute to Filter for Tests for specific category during the test run.
VSTest.console.exe MyProjectTest.dll /TestCaseFilter:TestCategory=MyCategory
Similarly, While using OpenCover we can use below format to generate the filtered coverage report.
OpenCover.Console.exe -register:user -target:"vstest.console.exe" -targetargs:"MyProjectTest.dll  /TestCaseFilter:TestCategory=MyCategory" -output:"coverage.xml"

Nuget Restore fails after installing the VS 2019 Preview

Image
The Nuget package restore errors out
EXEC : warning : Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored. [D:\[Code]\[Project]\MSBuild.csproj]

Resolve this by passing the MSBuild version to the nuget command.
<Target Name="NuGetRestorePackages">   <Message Text="Running NuGetRestorePackages :$(ToolsDir)nuget.exe restore $(SolutionPath) -MSBuildVersion 15.9 " Importance="high"/>   <Exec Command="$(ToolsDir)nuget.exe restore $(SolutionPath) -MSBuildVersion 15.9 "/> </Target>

Find the current version of Nuget Package Manager on machine

Image
Navigate to Visual Studio > View > Other Windows > Package Manager Console

Then Type command in the Console - $host

How to use Map in C#

I was reading a blog post “The Mistakes I Made As a Beginner Programmer” and wondering what are Maps and how can I use it in my C# code. So I googled a bit and found this article.
A Map is always better than a List for managing large collection of data with a Key or an ID. 
In JavaScript and many other languages, we have map<Key, Value> that allows us to look up and fetch the object using the Key.
In c# we can achieve the same functionality using the Dictionary<Key, Value> and SortedDictionary<Key, Value> objects.
std::map<Key, Value> → SortedDictionary<TKey, TValue> std::unordered_map<Key, Value> → Dictionary<TKey, TValue>
The advantage of using Map O(1)  is that it provides better performance over the List O(n). 
Reference: ·Maps in C# ·Equivalent of Map in C# ·BigO Notations C#