示例#1
0
        public void CreateDTOFromEntity_NullInput()
        {
            //Act
            var poemDTO = PoemDTO.CreateDTOFromEntity(entity: null);

            //Assert
            Assert.NotNull(poemDTO);
        }
示例#2
0
        public void CreateDTOFromEntity_ValidInput()
        {
            //Arrange
            var poemEntity = new PoemBuilder().Default().Build();

            poemEntity.PublishedRevision = poemEntity.PoemRevisions.FirstOrDefault();

            //Act
            var poemDTO = PoemDTO.CreateDTOFromEntity(poemEntity);

            //Assert
            Assert.NotNull(poemDTO);
            Assert.Equal(poemEntity.Id, poemDTO.Id);
            Assert.Equal(poemEntity.PublishedRevision.Title, poemDTO.Title);
            Assert.Equal(poemEntity.PublishedRevision.Body, poemDTO.Body);
        }