I think your result needs to be initialized, because on 5 your have null + "Buzz"
. I'm not a c# person so I don't know if that implicitly works.
Kudos for test cases, that is worth a tip! I suggest you test a few negative numbers and multiples of 3 and 5, maybe [-21, -25, -3, -15, 35, 33]
.
Maybe a c# person can chip in but I like this solution :)
It works, I have test cases to prove it :)
On a serious note, here's a quote from C# language specification: "If an operand of string concatenation is null, an empty string is substituted."
I also added tests for mentioned numbers and it seems to work fine (-21 returns "Fizz", 35 returns "Buzz", etc.).
Thanks for your feedback!
Interesting, that is a pretty cool feature. Thank you for pulling out the specifications 😊