Beispiel #1
0
        public void MapNull_ToNewObject_Mapped()
        {
            StubMapSource source = null;
            var           mapper = new StubMapper();
            var           target = mapper.Map(source, true);

            Assert.NotNull(target);
        }
Beispiel #2
0
        public void MapNull_ToNull_Mapped()
        {
            StubMapSource source = null;
            var           mapper = new StubMapper();
            var           target = mapper.Map(source);

            Assert.Null(target);
        }
Beispiel #3
0
        public void MapArray_Empty_Mapped()
        {
            var mapper = new StubMapper();

            var target = mapper.Map(
                Array.Empty <StubMapSource>());

            Assert.Empty(target);
        }
Beispiel #4
0
        public void Map_ToNewObject_Mapped()
        {
            var mapper = new StubMapper();
            var target = mapper.Map(new StubMapSource()
            {
                Property = 1
            });

            Assert.Equal(1, target.Property);
        }
Beispiel #5
0
        public void MapArray_Mapped()
        {
            var mapper = new StubMapper();
            var target = mapper.Map(
                new StubMapSource[]
            {
                new StubMapSource()
                {
                    Property = 1
                },
                new StubMapSource()
                {
                    Property = 2
                }
            });

            Assert.Equal(2, target.Count());
            Assert.Equal(1, target.FirstOrDefault()?.Property);
            Assert.Equal(2, target.LastOrDefault()?.Property);
        }