public async Task CreatePost_Test() { _postAppService = new PostAppService(_postRepositoryMock, _userRepositoryMock); PostInput postDto = new PostInput() { AuthorId = UsingDbContext <User>(a => a.User.FirstOrDefault()).Id, Content = "HI", Title = "title5" }; var post = new Post(postDto.AuthorId, postDto.Title, postDto.Content); //此时的_postRepositoryMock是模拟对象,用来断言 //只要InsertAsync方法接收到这些参数值就返回post实例 _postRepositoryMock.InsertAsync(Arg.Is <Post>( a => a.Content == post.Content && a.AuthorId == post.AuthorId && a.Title == post.Title)).Returns(post); //Act var flag = await _postAppService.CreatePost(postDto); //Assert //只要InsertAsync方法被调用,而且接收到参数值符合预期就断言通过 await _postRepositoryMock.Received().InsertAsync(Arg.Is <Post>( a => a.Content == post.Content && a.AuthorId == post.AuthorId && a.Title == post.Title)); this.Dispose(); }
public NewModel(IPostAppService postAppService, IBlogAppService blogAppService, IAuthorizationService authorization, IOptions <BloggingUrlOptions> blogOptions) { _postAppService = postAppService; _blogAppService = blogAppService; _authorization = authorization; _blogOptions = blogOptions.Value; }
public PostController(IPostAppService postAppService, IAsyncRepository <Post> postRepository, IAsyncRepository <CommunityUser> communityUserRepository) { _postAppService = postAppService; _postRepository = postRepository; _communityUserRepository = communityUserRepository; }
public CreatePostModel(IPostAppService postService, ICateAppService cateAppService, IHostingEnvironment hostingEnvironment, IAuthorizationService authorization) { this.postService = postService; this.cateAppService = cateAppService; this.hostingEnvironment = hostingEnvironment; this.authorization = authorization; }
public BlogController(IBlogAppService blogAppService, IPostAppService postAppService, IBlogManager blogManager, IPortalBlogAppService portalBlogAppService, IAppConfigurationAccessor appConfigurationAccessor) { _blogAppService = blogAppService; _postAppService = postAppService; _blogManager = blogManager; _portalBlogAppService = portalBlogAppService; _appConfigurationAccessor = appConfigurationAccessor; }
public AdminController(ISuggestionAppService suggestionAppService, IUserService userAppService, IAsyncRepository <User> userRepo, IPostAppService postAppService) { _suggestionAppService = suggestionAppService; _userAppService = userAppService; _userRepo = userRepo; _postAppService = postAppService; }
public IndexModel(IBlogAppService blogAppService, IPostAppService postAppService, ITagAppService tagAppService, IBlogManager blogManager, IGitlabClientAppService gitlabClientAppService, IMarkdownConverter markdownConverter) { _blogAppService = blogAppService; _postAppService = postAppService; _tagAppService = tagAppService; _blogManager = blogManager; _gitlabClientAppService = gitlabClientAppService; _markdownConverter = markdownConverter; }
public PortalBlogAppService(IGitlabClientAppService gitlabClientAppService, IMarkdownConverter markdownConverter, IPostAppService postAppService, IAppConfigurationAccessor appConfiguration, IPostManager postManager, ITagManager tagManager, BlogManager blogManager, IRepository <PostTag> postTagRepository) { _gitlabClientAppService = gitlabClientAppService; _markdownConverter = markdownConverter; _postAppService = postAppService; _appConfiguration = appConfiguration; _postManager = postManager; _tagManager = tagManager; _blogManager = blogManager; _postTagRepository = postTagRepository; }
public async Task GetPostsByAuthorId_Test() { //Arrange _postAppService = LocalIocManager.Resolve <IPostAppService>(); var authorId = UsingDbContext <Post>(a => a.Post.FirstOrDefault()).AuthorId; var postDtos = await _postAppService.GetPostsByAuthorId(authorId); postDtos.Count().ShouldBeGreaterThan(0); this.Dispose(); }
public BlogController() { this.postAppService = AppServiceFactory.GetPostAppService(); this.commentAppService = AppServiceFactory.GetCommentAppService(); }
public PostController(IPostAppService postAppService, IUriService uriService, IDocumentAppService documentAppService) { this.postAppService = postAppService; this.uriService = uriService; this.documentAppService = documentAppService; }
public BlogController(IPostAppService postAppService, ICommentAppService commentAppService) { this.postAppService = postAppService; this.commentAppService = commentAppService; }
public NewModel(IPostAppService postAppService, IBlogAppService blogAppService) { _postAppService = postAppService; _blogAppService = blogAppService; }
public PostAppService_Tests() { _postAppService = GetRequiredService <IPostAppService>(); _blogRepository = GetRequiredService <IBlogRepository>(); _postRepository = GetRequiredService <IPostRepository>(); }
public HomeController(IPostAppService postAppService, IFileManagerAppService fileManagerAppService) { _postAppService = postAppService; _fileManagerAppService = fileManagerAppService; }
public DetailsModel(IBlogAppService blogAppService, IPostAppService postAppService) { _blogAppService = blogAppService; _postAppService = postAppService; }
public PostController(IPostAppService postAppService, ICommentAppService commentAppService) { this._postAppService = postAppService; this._commentAppService = commentAppService; }
public PostDetailModel(IPostAppService postService, ICateAppService cateService) { this.postService = postService; this.cateService = cateService; }
public PostsController(IPostAppService postAppService) { this.postAppService = postAppService; }
public PostListModel(IPostAppService postService) { this.postService = postService; }
public PostAppService_Tests() { _testData = GetRequiredService <BloggingTestData>(); _postAppService = GetRequiredService <IPostAppService>(); _blogRepository = GetRequiredService <IBlogRepository>(); }
public PostController() { this.postAppService = AppServiceFactory.GetPostAppService(); }
public PostAppService_Tests() { _postAppService = Resolve <IPostAppService>(); }
public PostController(IPostAppService postAppService) { this.postAppService = postAppService; }
public PostAppService_Tests() { _postAppService = Resolve<IPostAppService>(); }
public DetailModel(IPostAppService postAppService, IBlogAppService blogAppService, ICommentAppService commentAppService) { _postAppService = postAppService; _blogAppService = blogAppService; _commentAppService = commentAppService; }
public PostController(IPostAppService postAppService) : base() => _postAppService = postAppService;
public PostController(IPostAppService postAppService) { _postAppService = postAppService; }
public TestJob(IPostAppService postAppService) { _postAppService = postAppService; }
public IndexModel(IPostAppService postAppService, IBlogAppService blogAppService, ITagAppService tagAppService) { _postAppService = postAppService; _blogAppService = blogAppService; _tagAppService = tagAppService; }
/// <summary> /// ctor /// </summary> /// <param name="postApp"></param> public PostController(IPostAppService postApp) { _postApp = postApp ?? throw new ArgumentNullException(nameof(postApp)); }
public EditModel(IPostAppService postAppService, IBlogAppService blogAppService, IAuthorizationService authorization) { _postAppService = postAppService; _blogAppService = blogAppService; _authorization = authorization; }
public BlogRelatedCategoryViewComponent(IPostAppService postAppService, IBlogAppService blogAppService) { _postAppService = postAppService; _blogAppService = blogAppService; }