Category Archives: .Net

Knockout, self, this, TypeScript. Are you still following?

Introduction I’m working on an MVC application with simple CRUD operations. I want the following functionality (don’t mind the Flemish (Dutch) titles): Remember, I’m “graphically handicapped”, so I’m afraid that my users will have to do with the standard Bootstrap … Continue reading

Posted in Codeproject, Debugging, Development, JavaScript, TypeScript | Tagged , | Leave a comment

Structuring an MVC app for easy testing

Introduction In this article I want to give you some handles to structure your MVC applications in such a way that they become easier to test. The article isn’t really about MVC, but if you want more information on MVC, I … Continue reading

Posted in .Net, Codeproject, Development, MVC, Testing | Leave a comment

Unit Testing your Repositories–the code

In the previous post I started to write about how to set up your unit tests in the repository code. The title was (maybe a bit misleading) “Unit testing your Repositories”. So I had to promise to write an article … Continue reading

Posted in .Net, Codeproject, Debugging, Development, Entity Framework, Testing | Tagged | 1 Comment

Unit testing your Repositories

The problem We have created our data layer, and of course we want to test it. It is very hard to use a (physical) database to test your code. There are some problems with this (commonly used) approach: Unit tests … Continue reading

Posted in .Net, Architecture, Codeproject, Development, Entity Framework, Testing | Tagged | 1 Comment

Creating an OData V4 service

I’m writing an agenda application, where the data can be delivered to the calendar control using either REST or OData V4. I choose the latter because this will allow for much more flexibility afterwards. I already have an MVC 5 … Continue reading

Posted in .Net, Codeproject, Development, MVC, MVC5, Web API | Tagged | 2 Comments

Using the repository pattern

In most applications database access is necessary. In .NET there are 2 main ways of doing this: ADO.NET or using the Entity Framework. Of course there are great 3rd party libraries like NHibernate that do the trick as well, and … Continue reading

Posted in .Net, Architecture, Codeproject, Development, MVC, WCF | Tagged | 3 Comments

Mocking functionality using MOQ

What is wrong with this code? class Program { static void Main(string[] args) { DateTime dob = new DateTime(1967, 7, 9); int days = CalcDays(dob); Console.WriteLine($”Days: {days}”); }     private static int CalcDays(DateTime dob) { return (DateTime.Today – dob).Days; } … Continue reading

Posted in .Net, Codeproject, Development, OOAD, Testing | Tagged | 1 Comment