exercism / exercism/csharp

International Calling Connoisseur - Tests should check for correct handling of duplicate Add().

Open
#1,845 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
427
Forks
383
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Add() throws if the key is already in the dictionary. I saw a bunch of passing solutions that don't check for the key before calling Add().

In general, there's lots of ways for dictionaries to throw exceptions when you do naive-but-seemingly-reasonable things, and the "Intro-to-Dictionaries" text might want to call out the common ways to go wrong.

Example test:

var countryCodes = DialingCodes.AddCountryToExistingDictionary(DialingCodes.GetExistingDictionary(), 91, "India");
Assert.Equal("India", countryCodes[91]);

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.