The current project I'm doing is a CQRS based project, using the ncqrs framework. Today I came to a phase I needed some mocking done for some of my domain services. I choose FakeItEasy to handle this for me. So I started by just adding a reference to my DomainScenario project using a Nuget package.
For some of my complexer scenario's I ran into some issues which took me about about 45 minutes to fix one of my tests. For fixing all other failing tests I had to do the same trick.
Before I explain the issue I ran into with FakeItEasy, I have to mention I use my aggregate roots to prepare my eventstore. My issue is related to this specific way of preparing the eventstore.
For example I have a Participant aggregate root like below.
As you can see both the edit and the construction of this aggregate use the same domain service to validate if the participant number is unique. Keep this in mind because of my eventstore preparation style, because this relates to the problem.
For my eventstore I use some fluent builder thing I built, which uses the domainobjects to generate the actual events.
This builder is used like below in my tests. Notice the GetChanges method is a extension method on my aggregateRoots.
For the test I want to do I registered my Fakes in first instance like below, which made my test fail. I am trying to test if the editing causes an 'FormattedParticipantNrShouldBeUniqueException' when changing the participantNr into an already excisting participantNr.
After 45 minutes searching and discussing with my colleague, we found a solution.
As you can see the solution was really simple, but hard to find, because debugging didn't highlighted this was the issue.
Just switch the order of configuring the Mocked/Faked object.
Last but not least I show you my actual test method.
I'm not sure if I was just doing it wrong or if FakeItEasy just needs a fix to prevent you running into this issue. Hope I made the issue clear and it will save you some time when encountering some same issues.
You have disabled cookies. To leave me a comment please allow cookies at functionality level.
Since today you can download the pre-release of Windows 8 (Developer preview). Since testing this new stuff out can be risky, it is best you do it in a virtual machine. You can download it the developer preview from the new Windows Dev Center. MSDN subscribers can download some additional win8 stuff.
Before you start you have to make sure your pc supports hardware virtualization. Here you can find how to enable it in the BIOS if your system supports it. https://www.microsoft.com/windows/virtual…
In this article I will explain how you can make cascading dropdowns with Knockout.js. Knockout.js is a JavaScript library which provides you some stuff to implement the MVVM pattern. Knockout provides you the following stuff:
Declarative bindings: (Easily associate DOM elements with model data using a concise, readable syntax);
Automatic UI Refresh: (When your data model's state changes, your UI updates automatically)
Dependency tracking: (Implicitly set up chains of relationships between mo…
While I was trying to apply DDD in combination with CQRS I learned myself some good lessons.
I was trying to apply this in an agile approach, using the project method SCRUM. I started the project by translating all use-cases to smaller user stories. Based on this user stories I defined a first sprint.
In the first sprint I didn't had or make a design for the complete domain. So I wasn't completely sure if I made the right decision for the 'aggregate root / bounded contexts' needed for the firs…
In this blog post I will explain how to inject your dependencies into your controllers in a MVC 3 application with Castle Windsor.
First of all you need to create a WindsorInstaller. This class is responsible for the configuration of your IoC container.
In the above class the first line registers all your controllers with lifestyle configured to Transient. Depending on the lifestyle you choose Windsor will clean all resources. Other lifestyles are Singleton, Pooled, PerWebRequest, PerThread. T…