Ejemplo n.º 1
0
        public void MapPropertySpecification_Test()
        {
            // arrange
            var dto1 = new StubDb {
                FullName = "John Doe"
            };
            var dto2 = new StubDb {
                FullName = "John Does"
            };
            var specification = new StubHasNameSpecification("John", "Doe");
            var sut           = new AutoMapperEntityMapper(StubEntityMapperConfiguration.Create());

            // act
            var result = sut.MapSpecification <StubPerson, StubDb>(specification).Compile();

            // assert
            result(dto1).ShouldBeTrue();
            result(dto2).ShouldBeFalse();
        }
Ejemplo n.º 2
0
        public void MapIdSpecification_Test()
        {
            // arrange
            var dto1 = new StubDb {
                Identifier = "111"
            };
            var dto2 = new StubDb {
                Identifier = "333"
            };
            var specification = new StubHasIdSpecification("111");
            var sut           = new AutoMapperEntityMapper(StubEntityMapperConfiguration.Create());

            // act
            var result = sut.MapSpecification <StubPerson, StubDb>(specification).Compile();

            // assert
            result(dto1).ShouldBeTrue();
            result(dto2).ShouldBeFalse();
        }