Ejemplo n.º 1
0
        public void PopulateImportantNoticesTest()
        {
            var document = new UnitTestDocument();
            var view     = new UnitTestDocumentView();
            var target   = new InsuranceRenewealReportPresenter(document, view);
            var im       = "http://mockImportantNotes.doc";
            var priv     = "http://mockPrivacy.doc";
            var fsg      = "http://mockFSG.doc";
            var toe      = "http://mockTOE.doc";

            document.MockBookmarks = new List <string>();
            document.MockBookmarks.Add(Constants.WordBookmarks.ImportantNotes);

            target.PopulateImportantNotices(Enums.Statutory.Retail, im, priv, fsg, toe);
            Assert.AreEqual(3, document.InsertedFiles.Count);

            document.InsertedFiles.Clear();
            target.PopulateImportantNotices(Enums.Statutory.Wholesale, im, priv, fsg, toe);
            Assert.AreEqual(3, document.InsertedFiles.Count);

            document.InsertedFiles.Clear();
            target.PopulateImportantNotices(Enums.Statutory.WholesaleWithRetail, im, priv, fsg, toe);
            Assert.AreEqual(4, document.InsertedFiles.Count);
        }
        private void PopulateDocument()
        {
            var template = GenerateTempalteObject();

            //change the graphics selected
            //if (Streams == null) return;
            _presenter.PopulateGraphics(template, lblCoverPageTitle.Text, lblLogoTitle.Text);

            if (_loadType == Helpers.Enums.FormLoadType.RibbonClick)
            {
                LogUsage(template, Helpers.Enums.UsageTrackingType.UpdateData);
                _presenter.PopulateData(template);
                return;
            }

            //popualte the basis of cover sections
            _presenter.PopulateBasisOfCover(_selectedDocumentFragments, Settings.Default.FragmentClassOfInsurance);



            var segmentDocuments = new Dictionary <Enums.Segment, string>
            {
                { Enums.Segment.One, String.Empty },
                { Enums.Segment.Two, Settings.Default.FragmentServicePlanSeg2 },
                { Enums.Segment.Three, Settings.Default.FragmentServicePlanSeg3 },
                { Enums.Segment.Four, Settings.Default.FragmentServicePlanSeg4 },
                { Enums.Segment.Five, Settings.Default.FragmentServicePlanSeg5 },
                { Enums.Segment.PersonalLines, String.Empty }
            };

            //remove basis of covers that have been unticked.
            // _presenter.RemoveBasisOfCover(_unslectedDocumentFragements);

            //populate service level segments
            _presenter.PopulateServiceLineAgrement(_selectedSegment, segmentDocuments, dtpPeriodOfInsuranceFrom.Value);

            _presenter.PopulatePurposeOfReport(_selectedSegment, Settings.Default.FragmentRRPurposeReport23,
                                               Settings.Default.FragmentRRPurposeReport45);

            //build remuneration documents
            var remunerationDocuments = new List <DocumentFragment>
            {
                new DocumentFragment
                {
                    Title = Enums.Remuneration.Fee.ToString(),
                    Url   = Settings.Default.FragementFeesRemuneration
                },
                new DocumentFragment
                {
                    Title = Enums.Remuneration.Combined.ToString(),
                    Url   = Settings.Default.FragementFeesCommission
                },
                new DocumentFragment
                {
                    Title = Enums.Remuneration.Commission.ToString(),
                    Url   = String.Empty
                }
            };

            _presenter.PopulateRemuneration(_selectedRemuneration, remunerationDocuments);

            _presenter.PopulateExecutiveSummary(_selectedRemuneration, Settings.Default.FragmentRREexSumFeeCommission,
                                                Settings.Default.FragmentRREexSumFeeCombine);

            _presenter.PopulateImportantNotices(_selectedStatutory, Settings.Default.FragmentStatutory,
                                                Settings.Default.FragmentPrivacy, Settings.Default.FragmentFSG,
                                                Settings.Default.FragmentTermsOfEngagement);
            _presenter.PopulateUFI(_populateUFI, Settings.Default.FragmentUFI);

            _presenter.PopulatePremiumSummary(_selectedDocumentFragments);

            if (rdoClitProfileYes.Checked)
            {
                _presenter.PopulateclientProfile(Settings.Default.FragmentClientProfile);
            }

            //TODO get this when IT is ready
            //if (_populateUFI)
            //_presenter.SendUFIMessage(template);

            //populate the content controls
            //populate data should be called last, as it ensures any inserted fragments get their controls populated.
            _presenter.PopulateData(template);

            _presenter.MoveToStartOfDocument();

            //tracking
            LogUsage(template,
                     _loadType == Helpers.Enums.FormLoadType.RegenerateTemplate
                         ? Helpers.Enums.UsageTrackingType.RegenerateDocument
                         : Helpers.Enums.UsageTrackingType.NewDocument);
        }