Skip to content

GeorgDangl/NetCoreHeroes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetCoreHeroes

This example is now configured for webpack, the latest commit targeting system.js can be found at commit def228f

This project is using the Visual Studio 2017 *.csproj format. The latest version that works with Visual Studio 2015 can be found at commit 9a5591c

Build Status

NetCoreHeroes is an example project for the Angular 2 Tour of Heroes tutorial using TypeScript in Visual Studio 2015. It's currently on Angular 4.1.3 and Asp.Net Core 1.1.2. I've published a few blog posts describing the process from setting up Visual Studio to Continuous Integration with Jenkins.

Instructions for building and testing the project on Linux are available here.

A live example is available here.

Build and run the project

Visual Studio: Restore node packages for the main NetCoreHeroes project and hit F5 to launch in debug mode.

Command Line: Run npm install, then npm run tsc to restore client side dependencies and compile TypeScript. npm run webpack creates the client side JavaScript bundles. You might use the WebPack Task Runner in Visual Studio to automatically regenerate the client side bundles when you debug the solution.

Then run dotnet restore and dotnet build to compile the Asp.Net Core backend. dotnet run starts the project.

Run unit tests

Asp.Net Core Tests

Just build the whole solution, the NetCoreHeroes.Tests project has the required xUnit dependencies so unit tests are automatically discovered in Visual Studio.

TypeScript Tests

To run the unit tests for Angular 2 components, get the Chutzpah Test Adapter for Visual Studio. The Angular 2 tests should then be available in the Visual Studio Test Explorer after a rebuild.

Visual Studio Test Explorer with Anngular 2 Unit Tests

This example includes tests using async and inject with a MockBackend to unit test the HeroService.