Kuba's space

Home

Using collections with MemberData attribute in F#

Feb 21, 20212 min read

Working with collections of custom types in xUnit always felt clumsy. To pass such a set of data, you had either create a property or a whole class. No matter which options you choose, it's a lot of boilerplate. What a pleasant surprise was how less ...

Using tuples for validations

Feb 9, 20212 min read

Many functional techniques are proving their ground in C# codebases. One of my favorites is the Result type. The most basic form consists of a boolean flag indicating success and an array of errors. But in many cases, tuples are just enough. I fall ...

Creating tasks in batches

Jan 26, 20213 min read

Recently I've learned that you have no control over tasks after initialization. Awaiting a job is just a way to synchronize and get a response. That naturally brings a question. How to split asynchronous calls into batches? A case from the trenches L...

Partial file staging with git

Jan 12, 20213 min read

After typing git status you can see files in three states: added to the index not added to the index not tracked at all It's likely to have the same file added and not added to the index. How is that possible? Let me introduce partial file stagin...

Tuple vs multiple params in F# functions

Dec 19, 20202 min read

In my mind, the F# code was almost braceless. I enjoyed reading it because it felt so natural.Recently, I wrote a bit of F# code. And guess what? There were way too many braces for my taste.Take a look at this code: let extractNumbers (numbers: Input...

Emberace MemberData attribute.

Dec 14, 20203 min read

Naming is hard. Well described test suites are even harder. I've seen a lot of tests that goes like this: [MemberData(nameof(Data))] public void EmailValidator_Should_Validate_Correctly( string data, bool expected) { var emailValidator = new Em...

© 2021 Kuba's space

PrivacyTerms
Proudly part of