Skip to content

Commit

Permalink
#26 corrected "tags" to "taglist"
Browse files Browse the repository at this point in the history
  • Loading branch information
mgroves committed Sep 29, 2023
1 parent e2b7e56 commit ad4f028
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static CreateArticleRequest Create(
Body = body,
Description = description,
Title = title,
Tags = tags
TagList = tags
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static CreateArticleSubmitModel Create(
Title = title,
Description = description,
Body = body,
Tags = tags
TagList = tags
};
return model;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public async Task Tags_must_be_on_the_approved_list()
{
// arrange
var request = CreateArticleRequestHelper.Create();
request.ArticleSubmission.Article.Tags = new List<string>
request.ArticleSubmission.Article.TagList = new List<string>
{
"not-approved-tag-" + Path.GetRandomFileName()
};
Expand Down Expand Up @@ -183,14 +183,14 @@ public async Task Tag_list_is_passed_through()
{
// arrange
var request = CreateArticleRequestHelper.Create();
request.ArticleSubmission.Article.Tags = _allTags.Take(1).ToList();
request.ArticleSubmission.Article.TagList = _allTags.Take(1).ToList();

// act
var result = await _handler.Handle(request, CancellationToken.None);

// assert
Assert.That(result, Is.Not.Null);
Assert.That(result.Article.TagList.Contains(request.ArticleSubmission.Article.Tags.Single()), Is.True);
Assert.That(result.Article.TagList.Contains(request.ArticleSubmission.Article.TagList.Single()), Is.True);
}

[Test]
Expand All @@ -213,7 +213,7 @@ public async Task Favorited_is_initially_false_FavoritesCount_is_zero()
{
// arrange
var request = CreateArticleRequestHelper.Create();
request.ArticleSubmission.Article.Tags = _allTags.Take(1).ToList();
request.ArticleSubmission.Article.TagList = _allTags.Take(1).ToList();

// act
var result = await _handler.Handle(request, CancellationToken.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task<CreateArticleResponse> Handle(CreateArticleRequest request, Ca
Description = request.ArticleSubmission.Article.Description.Trim(),
Body = request.ArticleSubmission.Article.Body.Trim(),
Slug = _slugService.GenerateSlug(request.ArticleSubmission.Article.Title.Trim()),
TagList = request.ArticleSubmission.Article.Tags,
TagList = request.ArticleSubmission.Article.TagList,
CreatedAt = new DateTimeOffset(DateTime.Now),
Favorited = false, // brand new article, no one can have favorited it yet
FavoritesCount = 0, // brand new article, no one can have favorited it yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public CreateArticleRequestValidator(ITagsDataService tagsDataService)
.MaximumLength(15000000).WithMessage("Body must be 15,000,000 characters or less.")
.MinimumLength(10).WithMessage("Body must be 10 characters or more.");

RuleFor(x => x.ArticleSubmission.Article.Tags)
RuleFor(x => x.ArticleSubmission.Article.TagList)
.Cascade(CascadeMode.Stop)
.MustAsync(BeAllowedTags).WithMessage("At least one of those tags isn't allowed.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ public class CreateArticleSubmitModelArticle
/// <summary>
/// Tags, optional. Any tags specified must be from the allowed list of tags.
/// </summary>
public List<string> Tags { get; set; }
public List<string> TagList { get; set; }
}

0 comments on commit ad4f028

Please sign in to comment.