Example #1
0
        public void Should_not_break_expression_chain_with_missed_expression()
        {
            ICommitMappingExpression   commitExp = null;
            ICodeFileMappingExpression fileExp   = null;

            commitMapper
            .Map(Arg.Any <IRepositoryMappingExpression>())
            .Returns(x =>
            {
                commitExp = Substitute.For <ICommitMappingExpression>();
                return(new ICommitMappingExpression[] { commitExp });
            });
            bugFixMapper
            .Map(Arg.Any <ICommitMappingExpression>())
            .Returns(x =>
            {
                return(new IBugFixMappingExpression[] {});
            });
            fileMapper
            .Map(Arg.Any <ICommitMappingExpression>())
            .Returns(x =>
            {
                fileExp = Substitute.For <ICodeFileMappingExpression>();
                return(new ICodeFileMappingExpression[] { fileExp });
            });

            mapper.RegisterMapper(commitMapper);
            mapper.RegisterMapper(bugFixMapper);
            mapper.RegisterMapper(fileMapper);

            mapper.MapRevision("1");

            fileMapper.Received(1)
            .Map(commitExp);
        }
Example #2
0
 public static ProjectFileMappingExpression File(this ICommitMappingExpression exp, string filePath)
 {
     return(new ProjectFileMappingExpression(
                exp,
                exp.Queryable <ProjectFile>().Single(x =>
                                                     x.Path == filePath && x.DeletedInCommitID == null
                                                     )
                ));
 }
Example #3
0
        public static TagMappingExpression HasTags(
            this ICommitMappingExpression exp, params string[] titles)
        {
            TagMappingExpression newExp = null;

            foreach (var title in titles)
            {
                newExp = new TagMappingExpression(newExp ?? exp, title);
            }

            return(newExp);
        }
Example #4
0
        public void Should_organize_expressions_into_chain()
        {
            ICommitMappingExpression   commitExp = null;
            IBugFixMappingExpression   bugfixExp = null;
            ICodeFileMappingExpression fileExp   = null;

            commitMapper
            .Map(Arg.Any <IRepositoryMappingExpression>())
            .Returns(x =>
            {
                commitExp = Substitute.For <ICommitMappingExpression>();
                return(new ICommitMappingExpression[] { commitExp });
            });
            bugFixMapper
            .Map(Arg.Any <ICommitMappingExpression>())
            .Returns(x =>
            {
                bugfixExp = Substitute.For <IBugFixMappingExpression>();
                return(new IBugFixMappingExpression[] { bugfixExp });
            });
            fileMapper
            .Map(Arg.Any <ICommitMappingExpression>())
            .Returns(x =>
            {
                fileExp = Substitute.For <ICodeFileMappingExpression>();
                return(new ICodeFileMappingExpression[] { fileExp });
            });

            mapper.RegisterMapper(commitMapper);
            mapper.RegisterMapper(bugFixMapper);
            mapper.RegisterMapper(fileMapper);

            mapper.MapRevision("1");

            commitMapper.Received(1)
            .Map(Arg.Any <IRepositoryMappingExpression>());
            bugFixMapper.Received(1)
            .Map(commitExp);
            fileMapper.Received(1)
            .Map(bugfixExp);
            fileMapper.Received(1)
            .Map(Arg.Any <ICommitMappingExpression>());
        }
Example #5
0
 /// <summary>
 /// Create a new sub-branch based on parent branch mask and offset.
 /// </summary>
 public static BranchMappingExpression OnSubBranch(
     this ICommitMappingExpression exp, BranchMask parentMask)
 {
     return(new BranchMappingExpression(exp, parentMask, true));
 }
Example #6
0
 /// <summary>
 /// Create a new branch or use the existent one with specified mask and offset.
 /// </summary>
 public static BranchMappingExpression OnBranch(
     this ICommitMappingExpression exp, BranchMask mask)
 {
     return(new BranchMappingExpression(exp, mask, false));
 }
Example #7
0
 /// <summary>
 /// Create a new branch from scratch without any parent branch.
 /// </summary>
 public static BranchMappingExpression OnFreshBranch(
     this ICommitMappingExpression exp)
 {
     return(new BranchMappingExpression(exp));
 }
Example #8
0
 public static BugFixMappingExpression IsBugFix(this ICommitMappingExpression exp)
 {
     return(new BugFixMappingExpression(exp));
 }
 public static ReleaseMappingExpression IsRelease(this ICommitMappingExpression exp, string tag)
 {
     return(new ReleaseMappingExpression(exp, tag));
 }
Example #10
0
 public static AuthorMappingExpression AuthorIs(
     this ICommitMappingExpression exp,
     string name)
 {
     return(new AuthorMappingExpression(exp, name));
 }
Example #11
0
 public static CommitAttributeMappingExpression IsMerge(
     this ICommitMappingExpression exp)
 {
     return(new CommitAttributeMappingExpression(
                exp, CommitAttribute.MERGE, null));
 }
Example #12
0
 public static CommitAttributeMappingExpression IsSplit(
     this ICommitMappingExpression exp)
 {
     return(new CommitAttributeMappingExpression(
                exp, CommitAttribute.SPLIT, null));
 }
Example #13
0
 public static ProjectFileMappingExpression AddFile(this ICommitMappingExpression exp, string filePath)
 {
     return(new ProjectFileMappingExpression(exp, filePath));
 }
Example #14
0
 public static TagMappingExpression HasTag(
     this ICommitMappingExpression exp, string title)
 {
     return(new TagMappingExpression(exp, title));
 }
Example #15
0
 public static CodeFileMappingExpression File(this ICommitMappingExpression exp, string filePath)
 {
     return(new CodeFileMappingExpression(exp, filePath));
 }