I recently ran into a problem when trying to use Code Contracts on Auto-Implemented Properties (i.e. Automatic Properties) combined with a C# interface. I started with a normal interface IScriptInvokerImpl where I wanted to define a method for running a PowerShell script and a public property for the PowerShell instance being used: A first implementation So a first implementation of […]
At d-fens we usually use JetBrains TeamCity as a build server. Because one of our customers uses Jenkins as build server I had the chance to set up a build job for one of our C#/.NET projects on Jenkins. The project I mentioned is a C#/.NET Web Application built with Visual Studio 2013. For testing we make use of the […]
This blog post is a bit more lengthly than my usual posts and the idea came from an issue I faced when working in one of our project where we use an OData v3 REST interface that talks to an MS SQL Server (2012 R2) via EntityFramework v6.1.3. In short: we wanted to implement ‘entity framework row level security’ (in […]
When using Microsoft CodeContracts your Contract.Requires and Contract.Ensures statements will throw a ContractException which you cannot catch (per design). This means that you cannot use the [ExceptedException] attribute to assert them. Furthermore when mocking with Telerik Justock you cannot use Contract.Ensures and Contract.Requires at all in your stubs, as the stub is expected to be a Func in the form […]
In one of our projects we started using Service Bus for Windows Server 1.1. After the installation and configuration we searched for a tool to visualize the local Service Bus […]
When writing ODATA controllers for our projects we spend quite some time on writing boilerplate code and input parameter validation. In addition, for our error handling we would like detailed information for internal troubleshooting but not so detailed information sent back to the client (i.e. no stack traces). In order to achieve this without extra work we started looking at […]
Todays blog post shows how to set up a build configuration on a JetBrains TeamCity 9.1 server that creates and publishes a NuGet package of a C#/.NET-Project. Build Configuration Setup […]
While working with OData controllers I came accross a challenge concerning authentication. The used authentication mode is Windows Authentication. I wanted to invoke an OData controller through a service reference from another OData controller with the user of the original call. The user of the original call has to be impersonated because the controller encapsulated as a service reference checks, […]
To etablish the principle of Behaviour Driven Development in our development process we searched for a possibility to verify, if an acceptance criteria is fullfilled or not. Because we usually host our repositories at GitHub we decided to use the GitHub issue tracker to describe our features and acceptance criterias. Setup Issues As a first step the following two additional […]
Today I would like to quickly present you how to unit test Web.API based OData Controllers the easy way. On biz.dfch.CS.Examples.Odata you find a complete code example and some accompanying information. The idea is based on the following information (and slightly enhanced): * Unit Testing Web API OData Services – Part 1 * Unit Testing Web API OData Services – […]
While searching for a mocking framework for C# .NET we of d-fens stumbled over JustMock. JustMock is a mocking framework for unit testing developed and maintained by Telerik. Besides JustMock Telerik provides a huge palette of development tools. The probably most popular tool developed by them is Fiddler. Now let’s go back to JustMock. There are two versions of JustMock […]
Prerequisites The following requirements have to be met for creating a build job for a C# project. Running TeamCity instance (Setup manual can be found here) MS Build Tools have […]
[Note] This is a rather old article from 2014. The world and PowerShell have changed. For an even easier way than presented here see the comment at the bottom of the article. In this post I present a quick refresher on how to make C# extension methods available to objects and classes in PowerShell sessions. C# allows you to extend […]
Today I would like to present you a simple ODATA search controller that you can use in LightSwitch (or any other ODATA consumer) to look up user accounts (and possibly other objects). When using SharePoint you will probably know the very convenient PeoplePicker. However, in LightSwitch (HTML) there is no equivalent to that. You certainly have “Person” objects/data types but […]
One of the cool features in PowerShell is the string handling – especially that of XML and JSON, with the help of Cmdlets like “ConvertFrom-Json” and the like. This all works very well when quickly converting small pieces of JSON data. However, as it turns out they have quite some shortcomings, as you can quickly find out for yourself when […]
I was working on a project where I needed a pool of PowerShell workers that were distributed across several nodes and should be served by a central dispatcher. So why not give AMQP with RabbitMQ a try? The setup was very easy thanks to the documentation. And besides plenty of .NET library wrappers around “Rabbit.MQ.Client.dll” there were even two PowerShell […]