Force xUnit.net to run tests serially

Force to run tests in test projects serially; (for integration or ui type of tests)
Add this to the xunit test project app.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
...
<add key="xunit.methodDisplay" value="method" />
<add key="xunit.parallelizeAssembly" value="false" />
<add key="xunit.parallelizeTestCollections" value="false" />
<add key="xunit.maxParallelThreads" value="1" />
...

docs:
https://xunit.github.io/docs/configuring-with-xml.html (.NET)
https://xunit.github.io/docs/configuring-with-json.html (.NET core)

 

 

C# .NET Selenium chromedriver.exe no disk in drive e: fix

If you get this alert message when debugging with the Selenium webdriver (v3.2) chromedriver (v2.27):

chromedriver.exe no disk
there is no disk in the drive. please insert a disk into drive e:

For me the problem was related to having an unmounted drive e: (open This PC window and check). If its not possible to unmount through windows right click menu, you can use this CMD: (run as administator):

mountvol e: /d

A simple bat file for this: (remember to run as Administrator):

@echo off
ECHO Must be runned as administrator to have access rights
mountvol e: /d
pause

 

Visual Studio – Trigger a xUnit test run after project build event

To trigger a xUnit test run after a successful build,
add this to the project “Build Events” / “Post-build event command line:”

"$(SolutionDir)\packages\xunit.runner.console.2.2.0\tools\xunit.console.x86.exe" "$(TargetPath)"

(You need xUnit runner console nuget package installed for this, above is for the 2.2.0 version).
Will produce something similar to this in the Output window “Build”:

 xUnit.net Console Runner (32-bit .NET 4.0.30319.42000)
 Discovering: MyApp.UnitTests 
 Discovered: MyApp.UnitTests 
 Starting: MyApp.UnitTests 
 Finished: MyApp.UnitTests 
=== TEST EXECUTION SUMMARY ===
 MyApp.UnitTests Total: 8, Errors: 0, Failed: 0, Skipped: 0, Time: 1,120s

Docs:
https://xunit.github.io/docs/getting-started-desktop.html#run-tests

How do I get NuGet to re-install/update all the packages in the packages.config?

Reinstall all packages in project:
Update-Package -reinstall -Project YourProjectName
Reinstall package “Antlr” in project:
Update-Package -reinstall Antlr -Project YourProjectName

See more here:

The following command will update all packages in every project to the latest version available from nuget.org.
Update-Package
You can also restrict this down to one project.
Update-Package -Project YourProjectName
If you want to reinstall the packages to the same versions as were previously installed then you can use the -reinstall argument with Update-Package command.
Update-Package -reinstall
You can also restrict this down to one project.
Update-Package -reinstall -Project YourProjectName
The -reinstall option will first uninstall and then install the package back again into a project.
Or, you can update the packages using the Manage Packages dialog.

Source: How do I get NuGet to install/update all the packages in the packages.config? – Stack Overflow

 

ASP.NET / .NET / VS blogs to follow

Microsoft Official

.NET Web Development and Tools Blog | Your official information source from the .NET Web Development and Tools group at Microsoft.
RSS: https://blogs.msdn.microsoft.com/webdev/feed

The Visual Studio Blog | The official source of product insight from the Visual Studio Engineering Team
RSS: https://blogs.msdn.microsoft.com/visualstudio/feed/

.NET Blog | A first-hand look from the .NET engineering teams
RSS: https://blogs.msdn.microsoft.com/dotnet/feed/

Non Microsoft

Dot Net Weekly:
http://www.dotnetweekly.com/
RSS: http://www.dotnetweekly.com/feed/

PetaPoco – lightweight .NET ORM

This one looks like a great .NET lightweight ORM:

PetaPocoA tiny ORM-ish thing for your POCOsPetaPocoMainDocumentationLicensePetaPoco is a tiny, fast, single-file micro-ORM for .NET and Mono.Like Massive it’s a single file that you easily add to any projectUnlike Massive it works with strongly typed POCO’sLike Massive, it now also supports dynamic Expandos too – read moreLike ActiveRecord, it supports a close relationship between object and database tableLike SubSonic, it supports generation of poco classes with T4 templatesLike Dapper, it’s fast because it uses dynamic method generation (MSIL) to assign column values to properties

Source: PetaPoco – Topten Software