public void FirearmLicenseReporterCorrectlyResetsControls() { var formA = new HashSet <IRejection>(); var formB = new HashSet <IRejection>(); var tstRej = new Rejection("Code1", "Desc1", "Reason1", RejectionState.REAPPLY); formA.Add(tstRej); formA.Add(new Rejection("Code2", "Desc2", "Reason2", RejectionState.AMENDIT)); formB.Add(new Rejection("Code3", "Desc3", "Reason3", RejectionState.FOREVER)); formB.Add(new Rejection("Code4", "Desc4", "Reason4", RejectionState.TMPCRIM)); mockRejList.SetupGet(f => f.FormA).Returns(formA); mockRejList.SetupGet(f => f.FormB).Returns(formB); var ctrlr = new FirearmLicenseController(ctrls, typeof(FakeReporter), typeof(FakeReporter), mockRejList.Object); ctrls.FormA.SetItemChecked(0, true); ctrls.FormB.SetItemChecked(1, true); ctrls.FormA.Enabled = false; ctrls.FormB.Enabled = false; ctrls.ActiveOffence.Visible = true; ctrls.Underage.Visible = true; ctrls.GenBkgndChk.Enabled = true; genReport.SimulateMouseUp(MouseButtons.Right); Assert.IsFalse(ctrls.FormA.GetItemChecked(0)); Assert.IsFalse(ctrls.FormB.GetItemChecked(1)); Assert.IsTrue(ctrls.FormA.Enabled); Assert.IsTrue(ctrls.FormB.Enabled); Assert.IsFalse(ctrls.ActiveOffence.Visible); Assert.IsFalse(ctrls.Underage.Visible); Assert.IsFalse(ctrls.GenBkgndChk.Enabled); }
public void FirearmLicenseControllerCorrectlyCopiesNameWithUnderscore() { mockRejList.SetupGet(f => f.FormA).Returns(new HashSet <IRejection>()); mockRejList.SetupGet(f => f.FormB).Returns(new HashSet <IRejection>()); var ctrlr = new FirearmLicenseController(ctrls, typeof(FakeReporter), typeof(FakeReporter), mockRejList.Object); ctrls.Name.Text = "Peter Jones"; ctrls.NameUnderscored.PerformClick(); Assert.AreEqual("Peter_Jones", Clipboard.GetText()); }
public void FirearmLicenseControllerCorrectlyGeneratesReport() { var formA = new HashSet <IRejection>(); var formB = new HashSet <IRejection>(); var tstRej = new Rejection("Code1", "Desc1", "Reason1", RejectionState.REAPPLY); formA.Add(tstRej); formA.Add(new Rejection("Code2", "Desc2", "Reason2", RejectionState.AMENDIT)); formB.Add(new Rejection("Code3", "Desc3", "Reason3", RejectionState.FOREVER)); formB.Add(new Rejection("Code4", "Desc4", "Reason4", RejectionState.TMPCRIM)); mockRejList.SetupGet(f => f.FormA).Returns(formA); mockRejList.SetupGet(f => f.FormB).Returns(formB); var ctrlr = new FirearmLicenseController(ctrls, typeof(FakeReporter), typeof(FakeReporter), mockRejList.Object); Assert.IsTrue(formA.SetEquals(ctrls.FormA.Items.Cast <IRejection>())); Assert.IsTrue(formB.SetEquals(ctrls.FormB.Items.Cast <IRejection>())); Assert.IsFalse(ctrls.GenReport.Enabled); ctrls.PrevDenial.Checked = true; Assert.IsTrue(ctrls.GenReport.Enabled); ctrls.LastOffence.Value = DateTime.UtcNow.AddMonths(-1); Assert.IsTrue(ctrls.ActiveOffence.Visible); ctrls.DateOfBirth.Value = DateTime.UtcNow.AddYears(-20); Assert.IsTrue(ctrls.Underage.Visible); ctrls.FormA.SetItemChecked(0, true); Assert.IsFalse(ctrls.FormB.Enabled); ctrls.FormB.SetItemChecked(0, true); Assert.IsFalse(ctrls.FormA.Enabled); Assert.IsTrue(ctrls.IsFormB.Checked); ctrls.FormB.SetItemChecked(0, false); ctrls.IsFormB.Checked = false; ctrls.FormA.Enabled = true; ctrls.Name.Text = "Joe Smith"; genReport.SimulateMouseUp(MouseButtons.Left); Assert.AreEqual(1, FakeReporter.ctorCalls.Count); var args = FakeReporter.ctorCalls[0]; Assert.AreEqual("Joe Smith", args[0] as string); Assert.IsFalse((bool)args[1]); Assert.AreEqual(ctrls.LastOffence.Value, (DateTime)args[2]); var rej = (args[3] as IEnumerable <object>).Cast <IRejection>(); Assert.AreEqual(1, rej.Count()); Assert.AreEqual(tstRej, rej.First()); }
public void FirearmLicenseReporterCorrectlyGeneratesBackgroundCheck() { var formA = new HashSet <IRejection>(); var formB = new HashSet <IRejection>(); var tstRej = new Rejection("Code1", "Desc1", "Reason1", RejectionState.REAPPLY); formA.Add(tstRej); formA.Add(new Rejection("Code2", "Desc2", "Reason2", RejectionState.AMENDIT)); formB.Add(new Rejection("Code3", "Desc3", "Reason3", RejectionState.FOREVER)); formB.Add(new Rejection("Code4", "Desc4", "Reason4", RejectionState.TMPCRIM)); mockRejList.SetupGet(f => f.FormA).Returns(formA); mockRejList.SetupGet(f => f.FormB).Returns(formB); var ctrlr = new FirearmLicenseController(ctrls, typeof(FakeReporter), typeof(FakeReporter), mockRejList.Object); ctrls.Name.Text = "Joe Smithy"; ctrls.GenBkgndChk.Enabled = true; ctrls.GenBkgndChk.PerformClick(); Assert.AreEqual(1, FakeReporter.ctorCalls.Count); Assert.AreEqual(1, FakeReporter.ctorCalls[0].Length); Assert.AreEqual("Joe Smithy", FakeReporter.ctorCalls[0][0] as string); }
public LSPDPMainForm() { InitializeComponent(); var arcControl = new ArrestReportController.Controls { SuspName = txtSuspect, SuspPhone = txtSuspPhone, LicensesRevoked = chkLicensesRevoked, ArrestingOfficers = txtArrestingOfficers, Mugshot = txtMugshot, ChkCrimes = chkCrimes, Narrative = txtNarrative, BtnGovEmployee = btnGovEmployee, BtnAttempted = btnAttempted, BtnAccessory = btnAccessory, BtnAggravated = btnAggravated, SuggestCharge = txtSuggestCharge, BtnGenArrestReport = btnGenArrestReport, }; _ = new ArrestReportController(arcControl, suspMgr, () => new ArrestReporter(), typeof(ArrestReporter), crimeList, "https://gov.eclipse-rp.net/posting.php?mode=reply&f=159&t=19"); var ircControl = new ImpoundReportController.Controls { SuspName = txtVehOwner, SuspPhone = txtPhoneNumber, LicensePlate = txtLicensePlate, VehicleModel = txtVehModel, VehicleColor = txtVehColour, VehicleDetails = txtVehDetails, ImpoundTime = dtImpoundTime, Location = txtImpoundLocation, Reason = txtReason, Officers = txtOfficersInvolved, Screenshot = txtScreenshot, TimestampConverter = txtTimestamp, BtnGenImpoundReport = btnGenImpoundReport, }; _ = new ImpoundReportController(ircControl, suspMgr, () => new ImpoundReporter(), typeof(ImpoundReporter), "https://gov.eclipse-rp.net/posting.php?mode=reply&f=565&t=7636"); var irrcControl = new ImpoundReleaseReportController.Controls { SuspName = txtRelVehOwner, SuspPhone = txtRelPhoneNum, LicensePlate = txtRelLicense, VehicleModel = txtRelModel, VehicleColor = txtRelColour, ImpoundDate = txtRelDate, ImpOfficer = txtRelOfficer, ReleaseFee = txtRelFee, BtnGenReleaseReport = btnGenReleaseReport, }; _ = new ImpoundReleaseReportController(irrcControl, suspMgr, typeof(ImpoundReleaseReporter), "https://gov.eclipse-rp.net/posting.php?mode=reply&f=565&t=7641"); var drcControl = new DutyReportController.Controls { Start = dtWatchStart, End = dtWatchEnd, Arrests = numArrests, Citations = numCitations, Notes = txtNotes, BtnGenDutyReport = btnGenDutyReport, }; _ = new DutyReportController(drcControl, () => new DutyReporter(), typeof(DutyReporter), OfficerData.OfficerDRs); var flControl = new FirearmLicenseController.Controls { Name = txtApplicant, PrevDenial = chkDeniedBefore, IsFormB = chkIsFormB, LastOffence = dtLastOffence, DateOfBirth = dtDOB, FormA = chkFormA, FormB = chkFormB, ActiveOffence = activeOffence, Underage = lblUnderage, NameUnderscored = btnNameUnderscore, GenBkgndChk = btnGenBkgndChk, GenReport = btnGenFirearmsVerdict, }; _ = new FirearmLicenseController(flControl, typeof(FirearmLicenseReporter), typeof(BackgroundCheckReporter), rejList); }