PowerShell How to prevent Invoke-RestMethod from un-escaping forward slashes You may also want to read Invoke-RestMethod cmdlet proxy – more on un-escaping forward slashes in URIs While working on RabbitMQTools module I came across a problem with un-escaping forward slashes in Urls by
PowerShell Working with REST services in PowerShell With PowerShell 3.0 comes a wonderful Invoke-RestMethod cmdlet which much simplifies using REST services. The cmdlet handles all communication as well as data serialisation/deserialisation. Below gist shows how easy it is
UnitTesting Arranging mocks using DSL One of the biggest problems with unit tests is poor readability. Bad naming convention, long methods, hard to understand Arrangement and Assert parts are making unit tests one of the hardest code to
.NET Framework The power of IEnumerable(T) When working with collections of data to which a set of rules, filters or data transformations has to be applied I often see implementations which are constructing one list after another to hold
UnitTesting Unit Tests as code specification When asking people what is the purpose of writing unit tests we usually get following answer: “To verify that the code actually does what it is supposed to do.” Among other responses we
Patterns Using policies to handle exceptions while calling external services Exception handling very easily gets ugly. Typical try...catch block clutters method and grows with any new exception discovered. Then, bits of code are copied between methods which require same error handling. Adding
.NET Framework Accepting user input: Beware of fullwidth characters If your application is accepting user input you should be ready to treat all kinds of “unexpected” data. This holds true especially when the application is facing open internet hence you should always
Patterns Create test objects using Builder pattern and methods chaining In my previous post “Create test objects using Factory Methods or Object Mother pattern” I described how Factory Method and Object Mother patterns can be used to help with creating object instances. Presented
Patterns Create test objects using Factory Methods or Object Mother pattern One of the nightmares in unit testing is creating instances of tested objects. While our tested object grows, very quickly the code repetition appears in the test fixture. It is very important to