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); }
private void ReloadPolicyClasses(IInsuranceRenewalReport v) { if (v.SelectedDocumentFragments == null) { v = _presenter.LoadIncludedPolicyClasses(v); } //repopulate selected fields foreach (var f in v.SelectedDocumentFragments) { var found = MinorItems.FirstOrDefault(x => x.Id == f.Id); if (found != null) { foreach (var no in tvaPolicies.AllNodes) { if (String.Equals(no.Tag.ToString(), found.MajorClass, StringComparison.OrdinalIgnoreCase)) { foreach (var cno in no.Children) { if (String.Equals(cno.Tag.ToString(), found.Title, StringComparison.OrdinalIgnoreCase)) { var path = tvaPolicies.GetPath(cno); var node = ((AdvancedTreeNode)path.LastNode); node.CheckState = CheckState.Checked; node.Checked = true; no.Expand(false); //var item = MinorItems.FirstOrDefault(i => String.Equals(i.Title, found.Title, StringComparison.OrdinalIgnoreCase)); node.Current = found.CurrentInsurer; node.Reccommended = found.RecommendedInsurer; _selectedDocumentFragments.Add(found); } } } } } } }
private void ReloadPolicyClasses(IInsuranceRenewalReport v, bool reload) { if (v.SelectedDocumentFragments == null) { v = _presenter.LoadIncludedPolicyClasses(v); } int reOrder = 0; //repopulate selected fields v.SelectedDocumentFragments.Sort((x, y) => y.Order.CompareTo(x.Order)); for (int index = v.SelectedDocumentFragments.Count - 1; index >= 0; index--) { var f = v.SelectedDocumentFragments[index]; var found = MinorItems.FirstOrDefault(x => x.Id == f.Id); if (found != null) { foreach (var no in tvaPolicies.AllNodes) { if (String.Equals(no.Tag.ToString(), found.MajorClass, StringComparison.OrdinalIgnoreCase)) { foreach (var cno in no.Children) { if (String.Equals(cno.Tag.ToString(), found.Title, StringComparison.OrdinalIgnoreCase)) { reOrder = reOrder + 1; var path = tvaPolicies.GetPath(cno); var node = ((AdvancedTreeNode)path.LastNode); node.CheckState = CheckState.Checked; node.Checked = true; no.Expand(false); if (reload) //on generate get them from cache as they're passed thru { node.Current = found.CurrentInsurer; node.Reccommended = found.RecommendedInsurer; node.OrderPolicy = reOrder.ToString(); node.ReccommendedId = found.RecommendedInsurerId; node.CurrentId = found.CurrentInsurerId; } else { node.Current = f.CurrentInsurer; node.Reccommended = f.RecommendedInsurer; node.OrderPolicy = reOrder.ToString(); node.ReccommendedId = f.RecommendedInsurerId; node.CurrentId = f.CurrentInsurerId; } } } //var item = // MinorItems.FirstOrDefault( // i => String.Equals(i.Title, f.Title, StringComparison.OrdinalIgnoreCase)); //if (item != null) //{ //_selectedDocumentFragments.Add(item); //} } } } } }