Unit testing AngularJS HTTP requests in the RAW Stack

In the previous blog post we created some basic unit tests for the AngularJS movies controller. As I mentioned there was one set of tests missing and that was around the controller doing HTTP requests to the WebAPI backend. In a unit test typically don’t want to do those test for real. First of all we don’t want to take a dependency on some external state and equally important we don’t want the overhead of those requests. Fortunately AngularJS makes it easy to fake those requests and test the controller bits in isolation.   The $httpBackend service One of the … Continue reading Unit testing AngularJS HTTP requests in the RAW Stack

Unit testing the AngularJS code in the RAW Stack

In the previous post we refactored the JavaScript code for our AngularJS controller a bit to make it more testable. However we didn’t actually start writing any tests yet so lets create a few tests.   The AngularJS controller under test Just as a quick reminder the AngularJS controller in our previous code was as follows 1: (function () { 2: ‘use strict'; 3: var module = angular.module("myApp", []); 4:  5: module.controller("moviesCtrl", function ($scope, $http) { 6: $http.get("/api/movies").then(function (e) { 7: $scope.movies = e.data; 8: }); 9: 10: $scope.newMovie = { Title: "" }; 11: $scope.addMovie = function () { … Continue reading Unit testing the AngularJS code in the RAW Stack

Refactoring the AngularJS code in the RawStack

In the previous post I created a minimal skeleton app to pass some movie data from RavenDB through a WebAPI endpoint to an AngularJS frontend and also to save new movies back to RavenDB. The code was, as I mentioned in that post, really minimal and by no means a good way of writing it. So in this post I am going to improve on the AngularJS part. It still will not be perfect but better.   Inline JavaScript There are cases where inline JavaScript mixed with you markup makes sense but as a general rule it should be avoided. … Continue reading Refactoring the AngularJS code in the RawStack

Creating a basic skeleton with the RAW stack

When I start with a new stack one of the first things I always do is create a really simple app to do something sort of meaningful. So lets do that with the RAW stack.   Just as a reminder the RAW stack is a combination of RavenDB, AngularJS and WebAPI. These three technologies combined make a pretty awesome combination for a developer wanting to make smart client side web applications and is using .NET on the server.   As the demo application I will be building is all about movie reviews and rentals lets start my a very minimalistic, … Continue reading Creating a basic skeleton with the RAW stack

Introducing the RAW stack

With this post I am introducing the RAW stack. Why the RAW stack? Well it is kind of the equivalent of the MEAN stack. Not that there is anything wrong with the MEAN stack, quite the opposite, but being a .NET developer I really like to keep using .NET where it’s strengths lie and where it is suitable. Now there are plenty of places where it isn’t but C# on the server is still quite awesome.   So what is the RAW stack? Basically the RAW stack consists of three parts. RavenDB AngularJS WebAPI   Why these three? RavenDB Well … Continue reading Introducing the RAW stack