public void TargetType()
        {
            // Arrange
            IConverter converter = new KeyValueConverter(new StringConverter(), new Int32Converter());
            var expectedType = typeof (KeyValuePair<string, int>);

            // Act
            var actualType = converter.TargetType;

            // Assert
            Assert.Equal(expectedType, actualType);
        }
        public void ConversionWithNullValue()
        {
            // Arrange
            IConverter converter = new KeyValueConverter(new StringConverter(), new Int32Converter());
            var value = "Test";
            var expectedKeyValue = "Test";

            // Act
            var actualValue = converter.Convert(value, converter.TargetType);

            // Assert
            Assert.NotNull(actualValue);
            var actualTuple = Assert.IsAssignableFrom<Tuple<object, object>>(actualValue);
            Assert.Equal(expectedKeyValue, (string) actualTuple.Item1);
            Assert.Null(actualTuple.Item2);
        }
        public void BadValueConversion()
        {
            // Arrange
            IConverter converter = new KeyValueConverter(new StringConverter(), new Int32Converter());
            var value = "Hello=Hello";
            var expectedExceptionMessage = Constants.ExceptionMessages.FormatConverterUnableConvert("Hello", typeof(int));
            var expectedInnerExceptionMessage = "Input string was not in a correct format.";

            // Act
            using (new LangageSwitcher("en-us"))
            {
                var actualException = Assert.Throws<CommandLineParserException>(() => converter.Convert(value, converter.TargetType));

                // Assert
                Assert.Equal(expectedExceptionMessage, actualException.Message);
                Assert.NotNull(actualException.InnerException);
                var actualInnerExecption = Assert.IsAssignableFrom<FormatException>(actualException.InnerException);
                Assert.Equal(expectedInnerExceptionMessage, actualInnerExecption.Message);
            }
        }
        public void EmptyValueConverter()
        {
            // Arrange
            IConverter converter = new KeyValueConverter(new StringConverter(), new Int32Converter());
            var expectedInnerExceptionMessage = @"value";
            var value = string.Empty;

            // Act
            var actualException = Assert.Throws<ArgumentNullException>(() => converter.Convert(value, converter.TargetType));

            // Assert
            Assert.Equal(expectedInnerExceptionMessage, actualException.ParamName);
        }