public void ShouldCallConverterChooserWithValuesAndReturnCreatedDict() { var converterChooserMock = new Mock <ISettingsConverterChooser>(); converterChooserMock .Setup(x => x.ChooseAndConvert <KeyValuePair <string, string>, KeyValuePair <long, int> >(It.IsAny <KeyValuePair <string, string> >())) .Returns <KeyValuePair <string, string> >(kvp => new KeyValuePair <long, int>(long.Parse(kvp.Key, CultureInfo.InvariantCulture), int.Parse(kvp.Value, CultureInfo.InvariantCulture))); var converter = new EnumerableConverter(converterChooserMock.Object); var expectedDict = new Dictionary <long, int> { { 1, 1 }, { 2, 2 } }; var rawValue = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("1", "1"), new KeyValuePair <string, string>("2", "2"), }; var convertedDict = converter.Convert <KeyValuePair <string, string>[], IReadOnlyDictionary <long, int> >(rawValue); converterChooserMock.Verify(x => x.ChooseAndConvert <KeyValuePair <string, string>, KeyValuePair <long, int> >(It.IsAny <KeyValuePair <string, string> >()), Times.Exactly(2)); CollectionAssert.AreEqual(new KeyValuePair <long, int> [0], expectedDict.Except(convertedDict).ToList()); }