Exemple #1
0
        public void WithDateFormats_NullableEmptyFormats_ThrowsArgumentException()
        {
            OneToOneMap <DateTime?> propertyMap = Map(t => t.NullableDateValue);

            Assert.Throws <ArgumentException>("formats", () => propertyMap.WithDateFormats(new string[0]));
            Assert.Throws <ArgumentException>("formats", () => propertyMap.WithDateFormats(new List <string>()));
        }
Exemple #2
0
        public void WithDateFormats_NullableNullFormats_ThrowsArgumentNullException()
        {
            OneToOneMap <DateTime?> mapping = Map(t => t.NullableDateValue);

            Assert.Throws <ArgumentNullException>("formats", () => mapping.WithDateFormats(null));
            Assert.Throws <ArgumentNullException>("formats", () => mapping.WithDateFormats((IEnumerable <string>)null));
        }
Exemple #3
0
        public void WithDateFormats_NullFormats_ThrowsArgumentNullException()
        {
            OneToOneMap <DateTime> propertyMap = Map(t => t.DateValue);

            Assert.Throws <ArgumentNullException>("formats", () => propertyMap.WithDateFormats(null));
            Assert.Throws <ArgumentNullException>("formats", () => propertyMap.WithDateFormats((IEnumerable <string>)null));
        }
Exemple #4
0
        public void WithDateFormats_NullableAutoMappedIEnumerableString_Success(IEnumerable <string> formats)
        {
            OneToOneMap <DateTime?> propertyMap = Map(t => t.NullableDateValue);

            Assert.Same(propertyMap, propertyMap.WithDateFormats(formats));

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

            Assert.Equal(formats, item.Formats);
        }
Exemple #5
0
        public void WithDateFormats_NullableAutoMappedStringArray_Success(IEnumerable <string> formats)
        {
            var formatsArray = formats.ToArray();

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

            Assert.Same(propertyMap, propertyMap.WithDateFormats(formatsArray));

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

            Assert.Same(formatsArray, item.Formats);
        }