コード例 #1
0
        public void MapTags_Should_Convert_List_Of_Tags_To_List_Of_TagDtos()
        {
            //Arrange
            var tagIds = CreateSomeTagId(3);
            var tags   = new TagTestBuilder().BuildList(tagIds.Count);

            //Act
            var tagDtos = TagMapper.MapTags(tagIds, tags);

            //Assert
            tagDtos.Count.Should().Be(tags.Count);
        }
コード例 #2
0
        public void MapTag_Should_Convert_Tag_To_TagDto()
        {
            //Arrange
            var tags = new TagTestBuilder().BuildList(3);

            //Act
            var tagDto = TagMapper.MapTag(tags.First().Id, tags);

            //Assert
            tagDto.Id.Should().Be(tagDto.Id);
            tagDto.Name.Should().Be(tagDto.Name);
        }
コード例 #3
0
        public void Constructor_Should_Construct_Tag_Properly()
        {
            //Arrange
            var builder = new TagTestBuilder();

            //Act
            var tag = builder.Build();

            //Assert
            Assert.Equal(builder.Id, tag.Id);
            Assert.Equal(builder.Name, tag.Name);
        }
コード例 #4
0
        public void MapQuestions_Should_Convert_List_Of_Questions_To_List_Of_QuestionDetailsDtos()
        {
            //Arrange
            var tagIds    = CreateSomeTagId();
            var tags      = new TagTestBuilder().BuildList(tagIds.Count);
            var questions = new QuestionTestBuilder().BuildList(3);

            //Act
            var questionDetailsDtos = _questionMapper.MapQuestions(questions, tags, 2);

            //Assert
            questionDetailsDtos.Count.Should().Be(questions.Count);
        }
コード例 #5
0
        public void MapQuestion_Should_Convert_Question_To_QuestionDetailsDto()
        {
            //Arrange
            var tagIds   = CreateSomeTagId();
            var tags     = new TagTestBuilder().BuildList(tagIds.Count);
            var question = new QuestionTestBuilder().WithTags(tagIds).Build();

            //Act
            var questionDto = _questionMapper.MapQuestion(question, tags);

            //Assert
            questionDto.Id.Should().Be(question.Id.DbId);
            questionDto.Body.Should().Be(question.Body);
            questionDto.Title.Should().Be(question.Title);
            questionDto.InquirerId.Should().Be(question.Inquirer.DbId);
            questionDto.Tags.Count.Should().Be(tagIds.Count);
        }