public virtual ApiPostServerRequestModel MapServerResponseToRequest(
            ApiPostServerResponseModel response)
        {
            var request = new ApiPostServerRequestModel();

            request.SetProperties(
                response.AcceptedAnswerId,
                response.AnswerCount,
                response.Body,
                response.ClosedDate,
                response.CommentCount,
                response.CommunityOwnedDate,
                response.CreationDate,
                response.FavoriteCount,
                response.LastActivityDate,
                response.LastEditDate,
                response.LastEditorDisplayName,
                response.LastEditorUserId,
                response.OwnerUserId,
                response.ParentId,
                response.PostTypeId,
                response.Score,
                response.Tag,
                response.Title,
                response.ViewCount);
            return(request);
        }
예제 #2
0
        public void MapModelToEntity()
        {
            var mapper = new DALPostMapper();
            ApiPostServerRequestModel model = new ApiPostServerRequestModel();

            model.SetProperties(1, 1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, 1, 1, 1, 1, "A", "A", 1);
            Post response = mapper.MapModelToEntity(1, model);

            response.AcceptedAnswerId.Should().Be(1);
            response.AnswerCount.Should().Be(1);
            response.Body.Should().Be("A");
            response.ClosedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.CommentCount.Should().Be(1);
            response.CommunityOwnedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.FavoriteCount.Should().Be(1);
            response.LastActivityDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.LastEditDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.LastEditorDisplayName.Should().Be("A");
            response.LastEditorUserId.Should().Be(1);
            response.OwnerUserId.Should().Be(1);
            response.ParentId.Should().Be(1);
            response.PostTypeId.Should().Be(1);
            response.Score.Should().Be(1);
            response.Tag.Should().Be("A");
            response.Title.Should().Be("A");
            response.ViewCount.Should().Be(1);
        }