Beispiel #1
0
        public void WithElementMap_MapReturnsNull_ThrowsArgumentNullException()
        {
            MemberInfo propertyInfo = typeof(TestClass).GetProperty(nameof(TestClass.Value));
            var        propertyMap  = new SubPropertyMap(propertyInfo);

            Assert.Throws <ArgumentNullException>("elementMap", () => propertyMap.WithElementMap(e => null));
        }
Beispiel #2
0
        public void WithElementMap_ValidMap_Success()
        {
            MemberInfo propertyInfo = typeof(TestClass).GetProperty(nameof(TestClass.Value));
            var        elementMap   = new SingleExcelPropertyMap <string>(propertyInfo);

            var propertyMap = new SubPropertyMap(propertyInfo);

            Assert.Same(propertyMap, propertyMap.WithElementMap(e =>
            {
                Assert.Same(e, propertyMap.ElementMap);
                return(elementMap);
            }));
            Assert.Same(elementMap, propertyMap.ElementMap);
        }