Setup .NET Core 2.1 project and test with XUnit on Linux VM

Working with .NET Core is so much fun, but it can be a little bit tricky sometimes, unit test projects with XUnit, how am I supposed to run the tests from CLI using .NET Core 2.1 runtime?
In this post I am going to quickly setup a .NET Core test project along with an XUnit test project and will run the tests on a Linux VM that I am going to setup with HashiCorp Vagrant.

Continue reading

ASP.NET Core 2.0 Authentication with local logins – Implementing custom authorization policies

This post is part of a series on ASP.NET Core 2.0 Authentication and I am going to talk about authorization policies, something different from what we’ve seen so far in the series, as most of posts are focusing in authorization.

I will show how to secure certain resources based on specific criteria on user’s claims.

Continue reading

ASP.NET Core 2.0 Authentication with local logins – Responding to backend changes

ASP.NET Core 2.0 makes it very easy and straightforward to setup a cookie authentication mechanism in your application. Framework provides numerous ways to achieve that, with or without ASP.NET Core Identity membership system.

This post is part of a series on ASP.NET Core 2.0 Authentication and I am about to talk about cookie events and how to respond to them.
Continue reading

ASP.NET Core 2.0 Authentication with local logins – Implementing claims transformation

ASP.NET Core 2.0 makes it very easy and straightforward to setup a cookie authentication mechanism in your application. Framework provides numerous ways to achieve that, with or without ASP.NET Core Identity membership system.

This post is part of a series on ASP.NET Core 2.0 Authentication and I am about to talk about cookie authentication and claims transformation.
Continue reading

Cookies

ASP.NET Core 2.0 Cookie Authentication – Local logins

ASP.NET Core 2.0 makes it very easy and straightforward to setup a cookie authentication mechanism in your application. Framework provides numerous ways to achieve that, with or without ASP.NET Core Identity membership system.

This post is part of a series on ASP.NET Core 2.0 Authentication and I am about to talk Cookie Authentication without ASP.NET Core Identity. I will show how to setup, login and logout using local logins, a custom implementation of a membership system. In the coming examples I will show how to simply secure your ASP.NET Core 2.0 MVC application using cookies and in-memory stored users, though they could be stored anywhere, database, flat files, etc.
In coming blog posts I am going to show a more appropriate way to do the local login authentication, using a database, signing-up users, transforming their claims, etc., but first let’s see something quick and simple.
Continue reading

Testing AngularJS UI-Route routes

Testing AngularJS UI-Router routes

Tests are important. In our AngularJS applications we have tons of stuff to test, we have unit tests on components, filters, directives and other AngularJS features, we have tests on templates and we also have tests on routes. Most sophisticated AngularJS applications might contain more than one page to display, so you need to have a routing mechanism to navigate to different components in the application.

The thing is how you test this? How you test your routed components? How you test the template with the routing directives?

That is exactly what I am going to talk about in this post. I prefer the AngularUI-Router, because it is really powerful, so this post will contain examples using this framework.

Continue reading

Generator

ES6 generators and async/await in Typescript

Some exciting features Javascript has developed during the latest versions (ES6, ES2016) are without doubt the generator functions and the async/await support.

These features exist in Typescript for quite some time; the language supported async/await since 1.7 version. But what about them? What they really are and how they work?
In this post I am going to explore their world, their Typescript syntax and implementations.

Continue reading

Socket.io integration tests with chai and mocha

All the goodies that you are building need to be of highest quality. But how is quality possible when no tests are in place?

If you have followed along, this very website promotes test driven development, very passionately if you ask me. I want my code to be thoroughly tested, I want confidence, I want speed. Remember, test driven development is the practice that makes you agile, in terms of speedy development and ability to cope with the code’s evolution. You go faster when you write tests.

That is no different when we code real time applications, in this particular instance, with socket.io, which heavily relies on an event driven style. We need to make sure that our channels, our business rules and the wiring work properly and that is exactly the story that I am going to tell you, so let’s dive in.

Continue reading