public void Create_from_StringEnumerable()
 {
     var value = StringEnumerable.ParseJsv("d,e,f");
     var convertedValue = TypeSerializer.SerializeToString(value);
     var result = TypeSerializer.DeserializeFromString<StringEnumerable>(convertedValue);
     Assert.That(result, Is.EquivalentTo(value.Items));
 }
コード例 #2
0
        public void ProxyModelMetadataInfoForStringEnumerableModel()
        {
            StringEnumerable model = new StringEnumerable
            {
                IEnumerableString = new[] { "One", "Two", "Three", "Four", "Five" }
            };

            var contentResult = GetResolvedContentResult(model);

            var expect = new Dictionary <string, string>()
            {
                ["IEnumerableString[0]"] = "One",
                ["IEnumerableString[1]"] = "Two",
                ["IEnumerableString[2]"] = "Three",
                ["IEnumerableString[3]"] = "Four",
                ["IEnumerableString[4]"] = "Five"
            };

            Assert.Equal(expect, contentResult.Dictionary);
            Assert.Equal(5, contentResult.Dictionary.Count);
        }