Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The exception does not get tested.
It would be helpful to inform the user on the appropriate values to populate the dictionary with in the instructions. Took me a while to find this out.
While this is a good learning Kata for C#, throwing an InvalidOperationException for a missing key is not best practice.
From Microsoft C# docs:
The hint in the starter code suggests using a dictionary as the underlying data structure. A dictionary would throw a "KeyNotFoundException" if the key isn't null and dictionary is not referenced with the TryGetValue method.
I'd suggest changing that test case to accept KeyNotFoundException as well.
The exception message is not tested.
The kata's proposed design for such a
Option
type is nonsense:IEnumerable
? WhatIEnumerable
means is that thisOptional
type can have0 to many
values. So the problem is not resolved at all, in fact it's even worse (it was0 or 1
before).IEnumerable<Customer>
? Why not make it a generic type? Why is it namedKata
and not something more meaningful (likeIMaybe
)?.Customer
and.GetEnumerator()
? It cannot be both a plain value or a collection of values at the same time: if it's a plain value you need to lift it to get a collection, if it's a collection you need toFind
/First
from it to get a plain value.Initial code namespace should be
MaybeKata
, notMaybeKata.Incomplete
.Demonstrating
Option
type in C# is a poor choice because it's not the C# standard practice: the standard practice is to use the null-conditional operators instead.The kata should be re-written in a language where such type exists and are used extensively as standard practice.
I think it's the opposite. At least in Haskell it's called
Maybe
, while in Scala it's calledOption
and in Java it's calledOptional
.As the kata currently stands it's completely pointless because the tests are not leveraging the benefit of the refactoring.
The point of turning
Status
into a class is that anyone can add newStatus
es from their side and the code will still work automatically with no changes toKata
class itself required. The tests or the description did not demonstrate any of this. So whatever learning value this kata might have it's whooshed from us; instead what we get is "refactor this way because I said so".Also, why check if there's a
_status
field? It's also pointless.Where are the random tests?
Test checking is woefully weak that nothing is enforced.
using System;
is missing in initial code.Initial code does not compile and gives tons of errors. If we're refactoring code I'd expect us to begin with code that can be run:
Your tests are too weak.
Expected and actual values are flipped.
Loading more items...