public void TestFindCitizen()
        {
            List <Citizen> result;

            result = _dao.FindCitizens(new Dictionary <CitizenSearchParam, object>
            {
                { CitizenSearchParam.Name, "Math" }
            }, SearchMatching.Similair);
            Assert.That(result.Count == 1, "search with \"math\" did not find mathilde!");
            result = _dao.FindCitizens(new Dictionary <CitizenSearchParam, object>
            {
                { CitizenSearchParam.Name, "Math" }
            }, SearchMatching.Exact);
            Assert.That(result.Count == 0, "Result where returned for exact search on \"math\"");
            result = _dao.FindCitizens(new Dictionary <CitizenSearchParam, object>
            {
                { CitizenSearchParam.Cpr, "2405901253" }
            }, SearchMatching.Exact);
            Assert.That(result.Count == 1, "Jens Dahl Møllerhøj could not be found via CPR");
            Assert.That(result[0].Name.Equals("Jens Dahl Møllerhøj"), "Person with CPR 2405901253 was not Jens Dahl Møllerhøj");
            result = _dao.FindCitizens(new Dictionary <CitizenSearchParam, object>()
            {
                { CitizenSearchParam.EligibleToVote, true },
                { CitizenSearchParam.HasVoted, false }
            });
            Assert.That(result.Count == 2);
            result = _dao.FindCitizens(new Dictionary <CitizenSearchParam, object>()
            {
                { CitizenSearchParam.Address, "nørre" },
                { CitizenSearchParam.Name, "jens" }
            });
            Assert.That(result.Count == 1);
            Assert.That(result[0].Name.Equals("Jens Dahl Møllerhøj"), "Person was not Jens Dahl Møllerhøj");
        }
Beispiel #2
0
 public List <Citizen> FindCitizens(Dictionary <CitizenSearchParam, object> data, SearchMatching matching = SearchMatching.Similair)
 {
     Contract.Requires(this.ActionPermitted(SystemAction.FindCitizen));
     this.TestPermission(SystemAction.FindCitizen, "you don't have permission to search for citizens");
     return(_dao.FindCitizens(data, matching));
 }