Cloud-First TDD with .net CORE — Part 2

Let’s start with a test

mkdir Tests
cd Tests
dotnet new classlib -f netcoreapp2.1
dotnet add package microsoft.aspnetcore.testhost -v 2.1.2
dotnet add package Microsoft.AspNetCore.App -v 2.1.2
dotnet add package nunit -v 3.10.1
dotnet add package NUnit3TestAdapter -v 3.10.0
dotnet add package Microsoft.NET.Test.Sdk -v 15.8.0
dotnet add reference ../App
Hello Test!
----- Test Execution Summary -----GivenHelloWorld.WhenIGetHelloMessage_ThenMessageIsRetrieved:Outcome: FailedError Message:System.Net.Http.HttpRequestException : Response status code does not indicate success: 404 (Not Found).Stack Trace:at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
at GivenHelloWorld.WhenIGetHelloMessage_ThenMessageIsRetrieved() in c:\source\cloudfirst\Tests\GivenHelloWorld.cs:line 15
----- Test Execution Summary -----GivenHelloWorld.WhenIGetHelloMessage_ThenMessageIsRetrieved:Outcome: Passed

Plumbing it all together

Running your pipeline

  • A locally-tested API
  • A YAML-compliant .gitlab-ci.yml configuration file
  • A working Serverless template
  • Your AWS secret and private keys plumbed in correctly as gitlab environment variables (here, if you haven’t!)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Shepherd

Chris Shepherd

14 Followers dev, barbershopper, homebrewer and human (not necessarily in that order).