Use Double loop TDD in Core 1.0

Today I will try to reuse Double TDD approach taken from Waldemar Mękal’s presentation on dotNetConf 2015th conference.

What Double loop TDD is?
DoubleLoopTDDIt is TDD but is doubled 😀 I am just kidding 😉
It is adjusted to start writing new feature from failing acceptance test and then write in sequence unit tests with mocks and after each test pass replace mocks with proper impementation until acceptance test pass.

Waldek presented his sample with helper classes, SystemUnderTest and Client, which land in the Infrastructure folder. Client uses Coypu as UI tester browser, so I opened NuGet Package Console and:
Install-Package coypu

When implementing Client class Resharper gives me a hint(figure below) to use Null Propagation(?.) new C# 6.0 feature. So then I read something about it to not be a noob in this subject. In short: When you use ?. it will be converted into an in-line if-statement(read more details here).
NullPropagation

Second part is SystemUnderTest, which uses Microsoft.DotNet.Hosting.WebHostBuilder(). Again NuGet Package Console:
Install-Package Microsoft.DotNet.Hosting

… and then many problems arises…

NuGet returns Logging warning and Concurrency error:
Install failed. Rolling back...
Package 'Microsoft.Extensions.Logging.1.0.0-rc1-final : Microsoft.Extensions.DependencyInjection.Abstractions [1.0.0-rc1-final, ), Microsoft.Extensions.Logging.Abstractions [1.0.0-rc1-final, )' does not exist in project 'FinData.Web.Tests'
Install-Package : Failed to add reference to 'System.Collections.Concurrent'. Please make sure that it is in the Global Assembly Cache.
At line:1 char:1
+ Install-Package Microsoft.AspNet.Hosting -Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

So I googled out and read something about gacutil.exe for registering *.dll in GAC.
Where to find gacutil? WIN -> Developer Command Prompt for VS20XX -> where gacutil
Gacutil localization depends from the framework version, but common part is: %systemDrive%\%ProgramFiles%\Microsoft SDKs\Windows\vX.XA\bin\NETFX X.X Tools\gacutil.exe

You do not need to know, where gacutil is. To add assembly to GAC just run Developer Command Prompt for VS with Administrative privileges and then run command: gacutil /i PathToDll.dll. Then console should give info: Assembly successfully added to the cache.

Yet another question: Where is it really installed? To What localization? When gacutil runs gives You info about own version, in my case Version 4.0.30319.0 says that most likely newly added *.dll comes to
C:\Windows\Microsoft.NET\Framework\v4.0.30319.
But my test project has .NET Framework version 4.6, so this assembly addition to GAC was unsuccessfull. I must manually copy/paste assembly to ReferenceAssemblies localization, in my case
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6

Then I saw, that after successfull Hosting installation by NuGet I have a lot of stuff in packages folder. I do not like this.

After these problems I started to understand, why Waldemar Mękal told that he prefers to hold test files in the same project, which is tested. In some next post I describe, that above problems are just the beginning, but first I will take closer look at BDD approach, which was used in this presentation.

One thought on “Use Double loop TDD in Core 1.0”

Leave a Reply

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>