コード例 #1
0
 public ClassTargetBlok(ArticleRole code, string name) : base()
 {
     ClassRole     = code;
     ClassName     = name;
     FullClassName = name + NAME_ARTICLE_POSTFIX;
     ValsClassName = name + NAME_SOURCES_POSTFIX;
 }
コード例 #2
0
 public ClassSourceBlok(SourceBlokBase parent, ArticleRole code, string name) : base(parent)
 {
     ClassCode     = code;
     ClassName     = name;
     FullClassName = name + NAME_ARTICLE_POSTFIX;
     ValsClassName = name + NAME_SOURCES_POSTFIX;
 }
コード例 #3
0
        public ArticleDefinition(ArticleRole article, IList <ArticleParametr> sources, IList <ArticleParametr> results)
        {
            Article = article;

            ArticleSources = sources;

            ArticleResults = results;
        }
コード例 #4
0
 public ClassArticleResultBlok(ArticleRole code, ArticleDefinition defs, string name) : base()
 {
     ClassCode     = code;
     ClassDefs     = defs;
     ClassName     = name;
     FullClassName = name + NAME_ARTICLE_POSTFIX;
     ValsClassName = name + NAME_SOURCES_POSTFIX;
 }
コード例 #5
0
        public ArticleDefinition(ArticleRole article)
        {
            Article = article;

            ArticleSources = new List <ArticleParametr>();

            ArticleResults = new List <ArticleParametr>();
        }
コード例 #6
0
 public ClassArticleValuesBlok(SourceBlokBase parent, ArticleRole code, ArticleDefinition defs, string name) : base(parent)
 {
     ClassCode     = code;
     ClassDefs     = defs;
     ClassName     = name;
     FullClassName = name + NAME_ARTICLE_POSTFIX;
     ValsClassName = name + NAME_SOURCES_POSTFIX;
 }
コード例 #7
0
        public static ArticleDefinition Create(ArticleRole article, params ArticleParametr[] arg)
        {
            IList <ArticleParametr> defnSources = arg.ToList();
            IList <ArticleParametr> defnResults = new List <ArticleParametr>();

            ArticleDefinition defn = new ArticleDefinition(article, defnSources, defnResults);

            return(defn);
        }
コード例 #8
0
        public async Task Can_GetGetArticleWithRolesAsync()
        {
            var expectedId        = Guid.NewGuid();
            var expectedTitle     = "some title";
            var expectedBody      = "some body";
            var expectedTimestamp = DateTime.ParseExact("01.02.2020", "dd.MM.yyyy", null);

            var article = new Blog.Domain.Article();

            article.Id        = expectedId;
            article.Title     = expectedTitle;
            article.Body      = expectedBody;
            article.Timestamp = expectedTimestamp;

            await this.articlesRepository.AddAsync(article);

            var role1          = new ApplicationRole("role1");
            var identityResult = await this.roleManager.CreateAsync(role1);

            Assert.True(identityResult.Succeeded);

            var role2 = new ApplicationRole("role2");

            identityResult = await this.roleManager.CreateAsync(role2);

            Assert.True(identityResult.Succeeded);

            var articleRole1 = new ArticleRole();

            articleRole1.Article = article;
            articleRole1.Role    = role1;

            await this.articleRolesRepository.AddAsync(articleRole1);

            var articleRole2 = new ArticleRole();

            articleRole2.Article = article;
            articleRole2.Role    = role2;

            await this.articleRolesRepository.AddAsync(articleRole2);

            var actual = await this.articlesRetriever.GetArticleWithRolesAsync(article.Id);

            Assert.Equal(expectedId, actual.Id);
            Assert.Equal(expectedTitle, actual.Title);
            Assert.Equal(expectedBody, actual.Body);
            Assert.Equal(expectedTimestamp, actual.Timestamp);
            Assert.True("role1, role2" == actual.Roles || "role2, role1" == actual.Roles);
        }
コード例 #9
0
ファイル: ArticlesService.cs プロジェクト: iluhakhurtin/blog
        private async Task UpdateArticleRoles(Article article, string[] roles)
        {
            await this.articleRolesRepository.DeleteAllForArticleAsync(article.Id);

            if (roles != null)
            {
                foreach (var role in roles)
                {
                    var applicationRole = await this.roleManager.FindByNameAsync(role);

                    var articleRole = new ArticleRole();
                    articleRole.Article = article;
                    articleRole.Role    = applicationRole;

                    await this.articleRolesRepository.AddAsync(articleRole);
                }
            }
        }
コード例 #10
0
 public static ArticleParametr CreateRefer(string name, FieldType type, ArticleRole refer)
 {
     return(new ArticleParametr(name, type, refer));
 }
コード例 #11
0
 public ArticleParametr(string name, FieldType type, ArticleRole refer)
 {
     Name  = name;
     Type  = type;
     Refer = refer;
 }
コード例 #12
0
 public ArticleParametr(string name, FieldType type)
 {
     Name  = name;
     Type  = type;
     Refer = ArticleRole.ARTICLE_UNKNOWN;
 }
コード例 #13
0
 public ClassMethodBlok(ArticleRole code, string name) : base()
 {
     ClassCode     = code;
     ClassName     = name;
     FullClassName = name + NAME_METHODS_POSTFIX;
 }
コード例 #14
0
 public ClassMethodBlok(SourceBlokBase parent, ArticleRole code, string name) : base(parent)
 {
     ClassCode     = code;
     ClassName     = name;
     FullClassName = name + NAME_METHODS_POSTFIX;
 }
コード例 #15
0
 public ClassDefinitionBlok(ArticleRole code, string name) : base()
 {
     ClassCode = code;
     ClassName = name;
 }
コード例 #16
0
 public ClassDefinitionBlok(SourceBlokBase parent, ArticleRole code, string name) : base(parent)
 {
     ClassCode = code;
     ClassName = name;
 }