Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public NewModel(IPostAppService postAppService, IBlogAppService blogAppService, IAuthorizationService authorization, IOptions <BloggingUrlOptions> blogOptions)
 {
     _postAppService = postAppService;
     _blogAppService = blogAppService;
     _authorization  = authorization;
     _blogOptions    = blogOptions.Value;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 5
0
 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;
 }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
        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();
        }
Esempio n. 10
0
 public BlogController()
 {
     this.postAppService    = AppServiceFactory.GetPostAppService();
     this.commentAppService = AppServiceFactory.GetCommentAppService();
 }
Esempio n. 11
0
 public PostController(IPostAppService postAppService, IUriService uriService, IDocumentAppService documentAppService)
 {
     this.postAppService     = postAppService;
     this.uriService         = uriService;
     this.documentAppService = documentAppService;
 }
Esempio n. 12
0
 public BlogController(IPostAppService postAppService, ICommentAppService commentAppService)
 {
     this.postAppService = postAppService;
     this.commentAppService = commentAppService;
 }
Esempio n. 13
0
 public NewModel(IPostAppService postAppService, IBlogAppService blogAppService)
 {
     _postAppService = postAppService;
     _blogAppService = blogAppService;
 }
Esempio n. 14
0
 public PostAppService_Tests()
 {
     _postAppService = GetRequiredService <IPostAppService>();
     _blogRepository = GetRequiredService <IBlogRepository>();
     _postRepository = GetRequiredService <IPostRepository>();
 }
 public HomeController(IPostAppService postAppService, IFileManagerAppService fileManagerAppService)
 {
     _postAppService        = postAppService;
     _fileManagerAppService = fileManagerAppService;
 }
Esempio n. 16
0
 public DetailsModel(IBlogAppService blogAppService, IPostAppService postAppService)
 {
     _blogAppService = blogAppService;
     _postAppService = postAppService;
 }
Esempio n. 17
0
 public PostController(IPostAppService postAppService, ICommentAppService commentAppService)
 {
     this._postAppService    = postAppService;
     this._commentAppService = commentAppService;
 }
Esempio n. 18
0
 public PostDetailModel(IPostAppService postService, ICateAppService cateService)
 {
     this.postService = postService;
     this.cateService = cateService;
 }
Esempio n. 19
0
 public PostsController(IPostAppService postAppService)
 {
     this.postAppService = postAppService;
 }
Esempio n. 20
0
 public PostListModel(IPostAppService postService)
 {
     this.postService = postService;
 }
Esempio n. 21
0
 public BlogController(IPostAppService postAppService, ICommentAppService commentAppService)
 {
     this.postAppService    = postAppService;
     this.commentAppService = commentAppService;
 }
Esempio n. 22
0
 public PostAppService_Tests()
 {
     _testData       = GetRequiredService <BloggingTestData>();
     _postAppService = GetRequiredService <IPostAppService>();
     _blogRepository = GetRequiredService <IBlogRepository>();
 }
Esempio n. 23
0
 public PostController()
 {
     this.postAppService = AppServiceFactory.GetPostAppService();
 }
 public PostAppService_Tests()
 {
     _postAppService = Resolve <IPostAppService>();
 }
Esempio n. 25
0
 public PostController(IPostAppService postAppService)
 {
     this.postAppService = postAppService;
 }
 public PostAppService_Tests()
 {
     _postAppService = Resolve<IPostAppService>();
 }
Esempio n. 27
0
 public DetailModel(IPostAppService postAppService, IBlogAppService blogAppService, ICommentAppService commentAppService)
 {
     _postAppService    = postAppService;
     _blogAppService    = blogAppService;
     _commentAppService = commentAppService;
 }
Esempio n. 28
0
 public BlogController()
 {
     this.postAppService = AppServiceFactory.GetPostAppService();
     this.commentAppService = AppServiceFactory.GetCommentAppService();
 }
Esempio n. 29
0
 public PostController(IPostAppService postAppService) : base() => _postAppService = postAppService;
 public PostController(IPostAppService postAppService)
 {
     _postAppService = postAppService;
 }
Esempio n. 31
0
 public TestJob(IPostAppService postAppService)
 {
     _postAppService = postAppService;
 }
Esempio n. 32
0
 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));
 }
Esempio n. 34
0
 public EditModel(IPostAppService postAppService, IBlogAppService blogAppService, IAuthorizationService authorization)
 {
     _postAppService = postAppService;
     _blogAppService = blogAppService;
     _authorization  = authorization;
 }
Esempio n. 35
0
 public BlogRelatedCategoryViewComponent(IPostAppService postAppService, IBlogAppService blogAppService)
 {
     _postAppService = postAppService;
     _blogAppService = blogAppService;
 }