Unit testing controllers with [Authorize] attribute in ASP.NET core

The Problem: Looking to unit test an [HttpPost] method in an [Authorize]d API controller I ran into a predicament.  My method has references to this.User and I found myself needing to mock the current user/claims principal.  I  looked through the API and nothing worked, this.User is read-only.  I looked at the https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/testing and there were no suggestions other … Continue reading Unit testing controllers with [Authorize] attribute in ASP.NET core

Angular Code Coverage in Sonar Qube and VSTS

To illustrate how to get this task done, I'll be working with a brand new Angular CLI project.  The final code for this project can be found on my GitHub repo found at https://github.com/pcalchi/SonarAngularDemo. This is what the final build process looks like. Using a hosted build agent is an option but I highly recommend using … Continue reading Angular Code Coverage in Sonar Qube and VSTS

Integrating Angular-CLI into the VSTS build process and achieving optimal performance

Recently it’s been brought to my attention that an Angular 2 application I wrote was almost 1mb in size.  My application has a Bootstrap 3.0 dependency which is a likely contributing factor.  The concern (rightfully so) is that this may be contributing to a low conversion rate on our website; particularly on mobile devices.  Keep … Continue reading Integrating Angular-CLI into the VSTS build process and achieving optimal performance

Integrating DevExtreme into an Angular CLI project

I’m a big fan of the Angular 2 framework, DevExtreme controls and most of all, Angular CLI.  Luckily the folks at DevExpress (makers of DevExtreme) have been nice enough to provide Angular 2 directives for their controls in an NPM package called devextreme-angular2.  Unfortunately, all of the existing code samples provided by DevExpress are based … Continue reading Integrating DevExtreme into an Angular CLI project