コード例 #1
0
        public void FieldsAreCorrectlyResetWhenRightClickIsTriggered()
        {
            var ctrlr = new ArrestReportController(ctrls, mockSuspMgr.Object, () => mockReporter.Object, rptT, mockCrimeList.Object);

            mockReporter.Setup(f => f.GetPrefill()).Returns("SomePrefill");
            officers.SetupProperty(f => f.Text);
            chkCrimes.SetItemChecked(0, true);
            btnGenArrestReport.SimulateMouseUp(MouseButtons.Right);
            mockReporter.VerifyAll();
            Assert.AreEqual("SomePrefill", officers.Object.Text);
            Assert.IsFalse(chkCrimes.GetItemChecked(0));
        }
コード例 #2
0
        public void PhoneNumbersAndNamesAreCorrectlyMatched()
        {
            var ctrlr = new ArrestReportController(ctrls, mockSuspMgr.Object, () => mockReporter.Object, rptT, mockCrimeList.Object);

            mockSuspMgr.Setup(f => f.FindFromName(It.IsAny <string>())).Returns(new Suspect("", "1234567"));
            ctrls.SuspName.Text = "Test";
            mockSuspMgr.VerifyAll();
            Assert.AreEqual("1234567", ctrls.SuspPhone.Text);
            mockSuspMgr.Setup(f => f.FindFromPhone(It.IsAny <string>())).Returns(new Suspect("Johnny", ""));
            ctrls.SuspName.Text  = "";
            ctrls.SuspPhone.Text = "1111111";
            mockSuspMgr.VerifyAll();
            Assert.AreEqual("Johnny", ctrls.SuspName.Text);
        }
コード例 #3
0
        public void ControllerSuccessfullyGeneratesAnArrestReport()
        {
            string[] strs = new string[] { "", "", "", "" };
            mockCrime1.SetupGet(f => f.Prefix).Returns(() => strs[0]);
            mockCrime1.SetupGet(f => f.Suffix).Returns(() => strs[1]);
            var ctrlr = new ArrestReportController(ctrls, mockSuspMgr.Object, () => mockReporter.Object, rptT, mockCrimeList.Object);

            chkCrimes.SetItemChecked(0, true);
            chkCrimes.SelectedIndex = 0;
            mockCrime1.Setup(f => f.AddSuffix(It.IsAny <string>())).Callback((string s) => strs[1] = s);
            mockCrime1.Setup(f => f.AddPrefix("Accessory to ")).Callback((string s) => strs[0]     = s);
            for (var i = 0; i < 3; ++i)
            {
                btnAccessory.PerformClick();
                btnGovEmployee.PerformClick();
            }
            mockCrime1.VerifyAll();

            chkCrimes.SelectedIndex = -1;
            btnAggravated.PerformClick();
            suggestCharge.Text = "Test2";
            mockCrime2.Setup(f => f.Equals(It.IsAny <string>())).Returns(true);
            suggestCharge.SimulateKeyUp(new KeyEventArgs(Keys.A));
            Assert.AreEqual(-1, chkCrimes.SelectedIndex);
            suggestCharge.SimulateKeyUp(new KeyEventArgs(Keys.Enter));
            mockCrime2.VerifyAll();
            Assert.AreEqual(1, chkCrimes.SelectedIndex);
            Assert.IsTrue(chkCrimes.GetItemChecked(1));

            officers.SetupProperty(f => f.Text, "john smith\nJane doe");
            officers.Setup(f => f.Multiline).Returns(true);
            ctrls.SuspName.Text           = "some crim";
            ctrls.SuspPhone.Text          = "1234567";
            ctrls.LicensesRevoked.Checked = true;
            ctrls.Mugshot.Text            = "abcdef";
            ctrls.Narrative.Text          = "Narrative";
            btnGenArrestReport.SimulateMouseUp(MouseButtons.Left);
            officers.VerifyAll();
            Assert.AreEqual("John Smith\nJane Doe", officers.Object.Text);
            Assert.AreEqual("Fake report", Clipboard.GetText());
            Assert.AreEqual(1, FakeReporter.ctorCalls.Count);
            var args = FakeReporter.ctorCalls[0];

            Assert.AreEqual(7, args.Length);
            var a = 0;

            Assert.AreEqual("Some Crim", args[a++] as string);
            Assert.AreEqual("1234567", args[a++] as string);
            Assert.IsTrue((bool)args[a++]);
            var offStrs = args[a++] as string[];

            Assert.AreEqual(2, offStrs.Length);
            Assert.AreEqual("John Smith", offStrs[0]);
            Assert.AreEqual("Jane Doe", offStrs[1]);
            Assert.AreEqual("abcdef", args[a++] as string);
            var crimes = (args[a++] as IEnumerable <object>).GetEnumerator();

            crimes.MoveNext();
            Assert.AreEqual(chkCrimes.Items[0] as Crime, crimes.Current as Crime);
            crimes.MoveNext();
            Assert.AreEqual(chkCrimes.Items[1] as Crime, crimes.Current as Crime);
            Assert.AreEqual("Narrative", args[a++] as string);
        }
コード例 #4
0
        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);
        }