Example #1
0
        public void TryParseCollectionWithBadSyntax()
        {
            var listOfIntArgType = new CollectionOfTArgumentType(typeof(List<int>));

            object value;
            listOfIntArgType.TryParse(ArgumentParseContext.Default, "1, z", out value).Should().BeFalse();
            value.Should().BeNull();
        }
Example #2
0
        public void TryParseCollection()
        {
            var listOfIntArgType = new CollectionOfTArgumentType(typeof(List<int>));

            object value;
            listOfIntArgType.TryParse(ArgumentParseContext.Default, "1, 2", out value).Should().BeTrue();
            value.Should().BeOfType<List<int>>();

            var list = (List<int>)value;
            list.Should().HaveCount(2);
            list.Should().ContainInOrder(1, 2);
        }