Esempio n. 1
0
        public void CanConvert_StringListType_True()
        {
            // arrange
            ListValueConverter converter = new ListValueConverter();
            ListType           type      = new ListType(new StringType());

            // act
            bool result = converter.CanConvert(type);

            // assert
            Assert.True(result);
        }
Esempio n. 2
0
        public void Convert_Null_Null()
        {
            // arrange
            ListValueConverter converter = new ListValueConverter();
            ListType           type      = new ListType(new StringType());

            // act
            bool result = converter.TryConvert(
                typeof(string[]), typeof(List <string>),
                null, out object convertedValue);

            // assert
            Assert.True(result);
            Assert.Null(convertedValue);
        }
Esempio n. 3
0
        public void Convert_StringArray_StringList()
        {
            // arrange
            ListValueConverter converter = new ListValueConverter();
            ListType           type      = new ListType(new StringType());

            string[] input = new string[] { "1", "2" };

            // act
            bool result = converter.TryConvert(
                typeof(string[]), typeof(List <string>),
                input, out object convertedValue);

            // assert
            Assert.True(result);
            Assert.IsType <List <string> >(convertedValue);
            Assert.Collection((List <string>)convertedValue,
                              t => Assert.Equal("1", t),
                              t => Assert.Equal("2", t));
        }