public void PopulateBasisOfCoverTest()
        {
            var document = new UnitTestDocument();

            document.MockBookmarks = new List <string> {
                "aBookMark", "bBookMark", "cBookMark"
            };

            var view   = new UnitTestDocumentView();
            var target = new InsuranceRenewealReportPresenter(document, view);
            var frags  = new List <IPolicyClass>();

            ;
            for (int i = 0; i < 2; i++)
            {
                var newFrag = new PolicyClass {
                    MajorClass = "A", Title = "A" + i, Url = "http//A" + i
                };
                frags.Add(newFrag);
            }

            for (int i = 0; i < 3; i++)
            {
                var newFrag = new PolicyClass {
                    MajorClass = "B", Title = "B" + i, Url = "http//B" + i
                };
                frags.Add(newFrag);
            }
            target.PopulateBasisOfCover(frags, "http://templates.oamps.com.au/Fragments/Class%20of%20Insurance.docx");
        }
        public InsuranceRenewalReportWizard(OfficeDocument document, Helpers.Enums.FormLoadType loadType)
        {
            InitializeComponent();

            tbcWizardScreens.SelectedIndexChanged += new EventHandler(tbcWizardScreens_SelectedIndexChanged);
            _checked.CheckStateChanged            += new EventHandler <TreePathEventArgs>(_checked_CheckStateChanged);

            _orderPolicy.ChangesApplied += new EventHandler(_textbox_ValueChanged);

            txtClientName.Validating          += txtClientName_Validating;
            txtClientCommonName.Validating    += txtClientCommonName_Validating;
            rdoSegment2.Validating            += rdoSegment_Validating;
            rdoSegment3.Validating            += rdoSegment_Validating;
            rdoSegment4.Validating            += rdoSegment_Validating;
            rdoSegment5.Validating            += rdoSegment_Validating;
            rdoWholesale.Validating           += rdoRetailWholesale_Validating;
            rdoWholesaleWithRetail.Validating += rdoRetailWholesale_Validating;
            rdoRetailFSG.Validating           += rdoRetailWholesale_Validating;
            rdoFeeOnly.Validating             += rdoFee_Validating;
            rdoCombination.Validating         += rdoFee_Validating;
            rdoCombination.Validating         += rdoFee_Validating;
            rdoUFIYes.Validating += rdoUFI_Validating;
            rdoUFINo.Validating  += rdoUFI_Validating;

            //send marketing template to the presenter

            _presenter         = new InsuranceRenewealReportPresenter(document, this);
            base.BasePresenter = _presenter;
            _loadType          = loadType;

            tvaPolicies.Resize += new EventHandler(tvaPolicies_Resize);

            _name.DrawText += new EventHandler <DrawEventArgs>(_name_DrawText);
        }
        public void LoadIncludedPolicyClassesTest()
        {
            var       document = new UnitTestDocument();
            IBaseView view     = null;

            document.MockDocumentProperties = new List <string>();

            InsuranceRenewealReportPresenter target = new InsuranceRenewealReportPresenter(document, view);
            var template = new InsuranceRenewalReport
            {
                ClientName       = "client name test",
                ClientCommonName = "client common name test"
            };

            var expected = new InsuranceRenewalReport
            {
                ClientName       = "client name test",
                ClientCommonName = "client common name test"
            };
            IInsuranceRenewalReport actual;

            actual = target.LoadIncludedPolicyClasses(template);
            Assert.AreEqual(expected.ClientCommonName, actual.ClientCommonName);
            Assert.AreEqual(expected.ClientName, actual.ClientName);
            Assert.AreEqual(expected.CoverPageTitle, actual.CoverPageTitle);
        }
        public void PopulateGraphicsTest()
        {
            var document = new UnitTestDocument();

            document.MockPageCount = 5;
            var template = new BaseTemplate();

            template.CoverPageTitle    = "a cover page";
            template.CoverPageImageUrl = "http://mockUrl";
            template.LogoTitle         = "a logo";
            template.LogoImageUrl      = "http://mockUrl";

            var view   = new UnitTestDocumentView();
            var target = new InsuranceRenewealReportPresenter(document, view);

            target.PopulateGraphics(template, String.Empty, String.Empty);
            Assert.IsNotNull(document.ImageAltText[0]);
            Assert.IsNotNull(document.ImageAltText[1]);
            Assert.IsNotNull(document.ImageUrl[0]);
            Assert.IsNotNull(document.ImageUrl[1]);

            target.PopulateGraphics(template, "previousCoverPage", String.Empty);
            Assert.IsNotNull(document.ImageAltText[0]);
            Assert.IsNotNull(document.ImageAltText[1]);
            Assert.IsNotNull(document.ImageUrl[0]);
            Assert.IsNotNull(document.ImageUrl[1]);

            target.PopulateGraphics(template, String.Empty, "previous Logo");
            Assert.IsNotNull(document.ImageAltText[0]);
            Assert.IsNotNull(document.ImageAltText[1]);
            Assert.IsNotNull(document.ImageUrl[0]);
            Assert.IsNotNull(document.ImageUrl[1]);

            target.PopulateGraphics(template, "Previous Cover Page", "previous Logo");
            Assert.IsNotNull(document.ImageAltText[0]);
            Assert.IsNotNull(document.ImageAltText[1]);
            Assert.IsNotNull(document.ImageUrl[0]);
            Assert.IsNotNull(document.ImageUrl[1]);

            target.PopulateGraphics(template, "a cover page", "a logo");
            Assert.IsNull(document.ImageAltText[0]);
            Assert.IsNull(document.ImageAltText[1]);
            Assert.IsNull(document.ImageUrl[0]);
            Assert.IsNull(document.ImageUrl[1]);


            target.PopulateGraphics(template, "a cover page", "something here");
            Assert.IsNull(document.ImageAltText[0]);
            Assert.IsNotNull(document.ImageAltText[1]);
            Assert.IsNull(document.ImageUrl[0]);
            Assert.IsNotNull(document.ImageUrl[1]);

            target.PopulateGraphics(template, "somerthing here", "a logo");
            Assert.IsNotNull(document.ImageAltText[0]);
            Assert.IsNull(document.ImageAltText[1]);
            Assert.IsNotNull(document.ImageUrl[0]);
            Assert.IsNull(document.ImageUrl[1]);
        }
        public void CheckNameTest()
        {
            var       document = new UnitTestDocument();
            IBaseView view     = null;
            InsuranceRenewealReportPresenter target = new InsuranceRenewealReportPresenter(document, view);
            const string name   = "Unit Test";
            bool         actual = target.CheckName(name);

            Assert.AreEqual(true, actual);
        }
        public void DeletePageTest()
        {
            var document = new UnitTestDocument();

            document.MockPageCount = 5;
            var view       = new UnitTestDocumentView();
            var target     = new InsuranceRenewealReportPresenter(document, view);
            int pageNumber = 2;

            target.DeletePage(pageNumber);

            document.MockPageCount = 1;
            pageNumber             = 1;
            target.DeletePage(pageNumber);
            Assert.AreNotSame(null, view.ReturnMessage);
        }
Exemplo n.º 7
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);
        }