示例#1
0
        public void SetUp()
        {
            _tokenReplacerFactory = Substitute.For <ITokenReplacerFactory>();
            _tokenReplacer        = new TokenReplacer();
            _tokenReplacer.AddStringToken("author", AuthorTokenValue);
            _tokenReplacer.AddStringToken("title", TitleTokenValue);
            _tokenReplacerFactory.BuildTokenReplacerWithoutOutputfiles(Arg.Any <Job>()).Returns(_tokenReplacer);
            _pageNumberCalculator = Substitute.For <IPageNumberCalculator>();
            _userTokenExtractor   = Substitute.For <IUserTokenExtractor>();

            _jobDataUpdater = new JobDataUpdater(_tokenReplacerFactory, _pageNumberCalculator, _userTokenExtractor);

            var jobInfo = new JobInfo();

            jobInfo.Metadata          = new Metadata();
            jobInfo.Metadata.Author   = "<author>";
            jobInfo.Metadata.Title    = "<title>";
            jobInfo.Metadata.Subject  = "Test Subject";
            jobInfo.Metadata.Keywords = "Test Keywords";
            var sfi1 = new SourceFileInfo();

            sfi1.Filename = PSFile1;
            jobInfo.SourceFiles.Add(sfi1);
            var sfi2 = new SourceFileInfo();

            sfi2.Filename = PSFile2;
            jobInfo.SourceFiles.Add(sfi2);

            var profile = new ConversionProfile();

            _job = new Job(jobInfo, profile, new Accounts());

            _userTokenExtractor.ExtractUserTokenFromPsFile(PSFile1, _job.Profile.UserTokens.Seperator).Returns(_userToken1);
            _userTokenExtractor.ExtractUserTokenFromPsFile(PSFile2, _job.Profile.UserTokens.Seperator).Returns(_userToken2);
        }
示例#2
0
 public JobDataUpdater(ITokenReplacerFactory tokenReplacerFactory, IPageNumberCalculator pageNumberCalculator, IUserTokenExtractor userTokenExtractor, IJobInfoManager jobInfoManager)
 {
     _tokenReplacerFactory = tokenReplacerFactory;
     _pageNumberCalculator = pageNumberCalculator;
     _userTokenExtractor   = userTokenExtractor;
     _jobInfoManager       = jobInfoManager;
 }