Exemple #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiPostsModelMapper();
            var model  = new ApiPostsResponseModel();

            model.SetProperties(1, 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);
            ApiPostsRequestModel response = mapper.MapResponseToRequest(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.Tags.Should().Be("A");
            response.Title.Should().Be("A");
            response.ViewCount.Should().Be(1);
        }
Exemple #2
0
        public virtual ApiPostsResponseModel MapBOToModel(
            BOPosts boPosts)
        {
            var model = new ApiPostsResponseModel();

            model.SetProperties(boPosts.Id, boPosts.AcceptedAnswerId, boPosts.AnswerCount, boPosts.Body, boPosts.ClosedDate, boPosts.CommentCount, boPosts.CommunityOwnedDate, boPosts.CreationDate, boPosts.FavoriteCount, boPosts.LastActivityDate, boPosts.LastEditDate, boPosts.LastEditorDisplayName, boPosts.LastEditorUserId, boPosts.OwnerUserId, boPosts.ParentId, boPosts.PostTypeId, boPosts.Score, boPosts.Tags, boPosts.Title, boPosts.ViewCount);

            return(model);
        }