Beispiel #1
0
        public void WithValueMap_MapReturnsNull_ThrowsArgumentNullException()
        {
            var cellValuesReader = new MultipleColumnNamesValueReader("Column");
            var valuePipeline    = new ValuePipeline <string>();
            CreateDictionaryFactory <string> createDictionaryFactory = elements => new Dictionary <string, string>();
            var propertyMap = new ManyToOneDictionaryMap <string>(cellValuesReader, valuePipeline, createDictionaryFactory);

            Assert.Throws <ArgumentNullException>("valueMap", () => propertyMap.WithValueMap(e => null));
        }
Beispiel #2
0
        public void WithValueMap_ValidMap_Success()
        {
            var cellValuesReader = new MultipleColumnNamesValueReader("Column");
            var valuePipeline    = new ValuePipeline <string>();
            CreateDictionaryFactory <string> createDictionaryFactory = elements => new Dictionary <string, string>();
            var propertyMap = new ManyToOneDictionaryMap <string>(cellValuesReader, valuePipeline, createDictionaryFactory);

            var newValuePipeline = new ValuePipeline <string>();

            Assert.Same(propertyMap, propertyMap.WithValueMap(e =>
            {
                Assert.Same(e, propertyMap.ValuePipeline);
                return(newValuePipeline);
            }));
            Assert.Same(newValuePipeline, propertyMap.ValuePipeline);
        }