Ejemplo n.º 1
0
        public void WithMapping_ValidReader_Success()
        {
            var dictionaryMapping = new Dictionary <string, DateTime> {
                { "key", DateTime.MinValue }
            };
            StringComparer comparer = StringComparer.CurrentCultureIgnoreCase;

            OneToOneMap <DateTime> propertyMap = Map(t => t.DateValue);

            Assert.Same(propertyMap, propertyMap.WithMapping(dictionaryMapping, comparer));

            DictionaryMapper <DateTime> item = propertyMap.Pipeline.CellValueMappers.OfType <DictionaryMapper <DateTime> >().Single();

            Assert.NotSame(dictionaryMapping, item.MappingDictionary);
            Assert.Equal(dictionaryMapping, item.MappingDictionary);

            Assert.Same(comparer, Assert.IsType <Dictionary <string, DateTime> >(item.MappingDictionary).Comparer);
        }
Ejemplo n.º 2
0
        public void WithMapping_NullMapping_ThrowsArgumentNullException()
        {
            OneToOneMap <string> propertyMap = Map(t => t.Value);

            Assert.Throws <ArgumentNullException>("mappingDictionary", () => propertyMap.WithMapping((Dictionary <string, string>)null));
        }