Skip to content

homework pengyu #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mechcodeman
Copy link

No description provided.

@slb-bgc-wk
Copy link

slb-bgc-wk commented Nov 8, 2023

WangKe
Goods:

  1. The three layers design meets the requirement.
  2. Well Dependency injection
  3. TDD for services and controllers

To Improve:

  1. There are 2 test case not passed, one for ArticleController, one for ArticleService.
  2. Baby step commit


namespace MiniBlog.Repositories
{
public class UserRepository : IUserRepository

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well: nice to also add UserRepository

@@ -12,39 +12,41 @@ public class ArticleService
{
private readonly ArticleStore articleStore = null!;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: remove unused articleStore & userStore

var mockArticle = new Mock<IArticleRepository>();
mockArticle.Setup(repo => repo.GetArticles()).Returns(Task.FromResult(new List<Article>
{
new Article("pengyu", "Let's smile to", "C#"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

// given
var newArticle = new Article("Jerry", "Let's code", "c#");
var newUser = new User(newArticle.UserName);
var mockArticle = new Mock<IArticleRepository>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: rename to mockArticleRepository or mockArticleRepo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants