Beispiel #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiPostModelMapper();
            var model  = new ApiPostResponseModel();

            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);
            ApiPostRequestModel 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.Tag.Should().Be("A");
            response.Title.Should().Be("A");
            response.ViewCount.Should().Be(1);
        }
Beispiel #2
0
        public virtual ApiPostResponseModel MapBOToModel(
            BOPost boPost)
        {
            var model = new ApiPostResponseModel();

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

            return(model);
        }