Running tests Run command from Angular5 project folder: ng test Create an injectable service with an interface This allows to define a typescript interface implemented by a class For injection is actually used the AUTHENTICATION_SERVICE token import { Injectable, InjectionToken } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; export interface IAuthenticationService { login(username: string, password: string): Observable<any>; extendToken(): Observable<any>; logout(); isLoggedIn(): boolean; hasRole(role: string): boolean; } export const AUTHENTICATION_SERVICE = new InjectionToken<IAuthenticationService>('AUTHENTICATION_SERVICE'); @Injectable() export class AuthenticationService implements IAuthenticationService { constructor(private http: HttpClient) { } // returns actually the token login(username: string, password: string): Observable<any> { return this.

Read more →

pipeline { agent none environment { RELEASE_NUMBER = '17.1.1' VERSION_NUMBER = VersionNumber(versionNumberString: '17.1.1.${BUILDS_ALL_TIME}') } stages { stage('Checkout from GIT'){ agent any steps { script { currentBuild.displayName = "#${VERSION_NUMBER}" } checkout scm } } stage('NUGET package restore') { agent { label 'nuget' } steps { echo 'Restoring nuget packages' bat '"%NUGET_PATH%" restore TestSolution.sln' dir ('.') { stash 'sources' } } } stage('Build') { agent { label 'dotNET_4.7'} steps { dir ('.') { unstash 'sources' } bat "\"${tool name: 'Default', type: 'msbuild'}\\msbuild.

Read more →

Couple of notes on setting up a project on Angular5 utilizing .NET Core 2.0 WebAPI. Code organization ProjectRootFolder | +.git | +-AngularProjectFolder | +-dotNetCoreProjectFolder | +-wwwroot Project setup Create project root folder with git repository: mkdir ProjectRootFolder cd ProjectRootFolder git init Create dotNet Core API application dotnet new webapi -n ProjectWebApi Create Angular 5 application Assumes Angular5 CLI is available already (see https://angular.

Read more →

When creating build agent docker image usually you need to install SDKs from MSI (like Infragistic, DevExpress, Active Reports etc.). There are couple of challenges here: Windows Docker doesn’t support UI. Also very often you have to populate UI with values. For this purpose MSI supports so called unattended installs. For input values you can pass those as parameters to MSI on command line. Let’s assume that we want to install SDK like Infragistic.

Read more →

I got reminded recently about two cases why it may be actually a bad idea to do a complex initialization in a class constructor in C#. All the code samples below are written just for the purpose of this post but are based on real code I either written or came across at some point. Case 1 - instance resolved via an IoC container Recently I was facing an issue that application started but remained non-functional.

Read more →