public void TestGetBadPermit()
        {
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            Permit             permit  = adapter.GetPermit("PERMNUM_45");

            Assert.IsNull(permit);
        }
        public void TestGetBadInspection()
        {
            IOpenPermitAdapter adapter    = new SQLOpenPermitAdapter();
            Inspection         inspection = adapter.GetInspection("PERMNUM_15", "-1");

            Assert.IsNull(inspection);
        }
        public void TestNoFilter()
        {
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List <Permit>      permits = adapter.SearchPermits(new PermitFilter());

            Assert.AreEqual(30, permits.Count);
        }
        public void TestGetPermitInspections()
        {
            IOpenPermitAdapter adapter     = new SQLOpenPermitAdapter();
            List <Inspection>  inspections = adapter.GetInspections("PERMNUM_15");

            Assert.AreEqual(inspections.Count, 10);
        }
        public void TestGetPermitTimeline()
        {
            IOpenPermitAdapter  adapter  = new SQLOpenPermitAdapter();
            List <PermitStatus> timeline = adapter.GetPermitTimeline("PERMNUM_15");

            Assert.AreEqual(timeline.Count, 10);
        }
        public void TestGetExistingPermit()
        {
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            Permit             permit  = adapter.GetPermit("PERMNUM_17");

            Assert.IsNotNull(permit);
            Assert.AreEqual("34RT56890317", permit.ContractorLicNum);
        }
        public void TestNoFilterMatchStatusMultipleStatuses()
        {
            PermitFilter filter = new PermitFilter();

            filter.Status = new List <StatusChoices>(new StatusChoices[] { StatusChoices.Applied, StatusChoices.Closed });
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List <Permit>      permits = adapter.SearchPermits(filter);

            Assert.AreEqual(15, permits.Count);
        }
        public void TestNoFilterMatchMechanical()
        {
            PermitFilter filter = new PermitFilter();

            filter.Types = new List <TypeChoices>(new TypeChoices[] { TypeChoices.Mechanical });
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List <Permit>      permits = adapter.SearchPermits(filter);

            Assert.AreEqual(6, permits.Count);
        }
        public void TestMatchByAddress()
        {
            PermitFilter filter = new PermitFilter();
            filter.Address = "825 NW 129 Ave Miami, FL 33182";
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List<Permit> permits = adapter.SearchPermits(filter);

            Assert.AreEqual(permits.Count, 1);
        }
        public void TestGetPermitInspection()
        {
            IOpenPermitAdapter adapter       = new SQLOpenPermitAdapter();
            List <Inspection>  inspections   = adapter.GetInspections("PERMNUM_15");
            Inspection         refInspection = inspections[5];
            Inspection         inspection    = adapter.GetInspection("PERMNUM_15", refInspection.Id);

            Assert.IsNotNull(inspection);
            Assert.AreEqual(refInspection.Inspector, inspection.Inspector);
        }
        public void TestNoMatchByAddress()
        {
            PermitFilter filter = new PermitFilter();

            filter.Address = "9672 SW 158th Ave Miami, FL 33196";
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List <Permit> permits = adapter.SearchPermits(filter);

            Assert.AreEqual(permits.Count, 0);
        }
        public void TestNoMatchByAddress()
        {
            PermitFilter filter = new PermitFilter();
            filter.Address = "9672 SW 158th Ave Miami, FL 33196";
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List<Permit> permits = adapter.SearchPermits(filter);

            Assert.AreEqual(permits.Count, 0);

        }
        public void TestMatchByAddress()
        {
            PermitFilter filter = new PermitFilter();

            filter.Address = "825 NW 129 Ave Miami, FL 33182";
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List <Permit> permits = adapter.SearchPermits(filter);

            Assert.AreEqual(permits.Count, 1);
        }
        public void TestNoFilterMatchTimeFrameClosed()
        {
            PermitFilter filter = new PermitFilter();

            filter.TimeFrame = new Tuple <StatusChoices, DateTime, DateTime>(StatusChoices.Closed,
                                                                             Convert.ToDateTime("01/01/2013"), Convert.ToDateTime("01/01/2014"));
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List <Permit>      permits = adapter.SearchPermits(filter);

            Assert.AreEqual(8, permits.Count);
        }
        public void TestMatchBadAddress()
        {
            PermitFilter filter = new PermitFilter();

            filter.Address = "WE$R@cdfg45";
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List <Permit> permits = adapter.SearchPermits(filter);

            Assert.IsNull(permits);
        }
        public void TestMatchBadAddress()
        {
            PermitFilter filter = new PermitFilter();
            filter.Address = "WE$R@cdfg45";
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List<Permit> permits = adapter.SearchPermits(filter);

            Assert.IsNull(permits);

        }
        public void TestBadBox()
        {
            PermitFilter filter = new PermitFilter();
            Box          box    = new Box();

            box.MinX           = -85;
            box.MaxX           = -84;
            box.MinY           = 20;
            box.MaxY           = 21;
            filter.BoundingBox = box;
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List <Permit>      permits = adapter.SearchPermits(filter);

            Assert.AreEqual(0, permits.Count);
        }
        private List <Permit> GetBoxPermits(List <TypeChoices> types, FieldChoices fields = FieldChoices.All)
        {
            PermitFilter filter = new PermitFilter();
            Box          box    = new Box();

            box.MinX           = -81;
            box.MaxX           = -80;
            box.MinY           = 25;
            box.MaxY           = 26;
            filter.BoundingBox = box;
            filter.Types       = types;
            filter.Fields      = fields;
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List <Permit>      permits = adapter.SearchPermits(filter);

            return(permits);
        }
Пример #19
0
        private static Tuple <List <Permit>, List <Permit> > getPermitsToSync()
        {
            HashSet <string> closedPermits = new HashSet <string>();
            HashSet <string> openedPermits = new HashSet <string>();

            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List <Permit> knownPermits = adapter.SearchPermits(new PermitFilter());

            string[] unactivePermits = new string[] { "CLOSED", "EXPIRED" };

            foreach (Permit permit in knownPermits)
            {
                if (unactivePermits.Contains(permit.StatusCurrent))
                {
                    closedPermits.Add(permit.PermitNum);
                }
                else
                {
                    openedPermits.Add(permit.PermitNum);
                }
            }

            List <Permit> mdcPermits = getSocrataPermits();

            List <Permit> existingPermits = new List <Permit>();
            List <Permit> newPermits      = new List <Permit>();

            foreach (Permit permit in mdcPermits)
            {
                //Permit is not closed
                if (permit.PermitNum != null && !closedPermits.Contains(permit.PermitNum))
                {
                    if (openedPermits.Contains(permit.PermitNum))
                    {
                        existingPermits.Add(permit);
                    }
                    else
                    {
                        newPermits.Add(permit);
                    }
                }
            }

            return(new Tuple <List <Permit>, List <Permit> >(newPermits, existingPermits));
        }
        private List<Permit> GetBoxPermits(List<TypeChoices> types, FieldChoices fields = FieldChoices.All)
        {
            PermitFilter filter = new PermitFilter();
            Box box = new Box();

            box.MinX = -81;
            box.MaxX = -80;
            box.MinY = 25;
            box.MaxY = 26;
            filter.BoundingBox = box;
            filter.Types = types;
            filter.Fields = fields;
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List<Permit> permits = adapter.SearchPermits(filter);

            return permits;
        }
        public void TestBadBox()
        {
            PermitFilter filter = new PermitFilter();
            Box box = new Box();

            box.MinX = -85;
            box.MaxX = -84;
            box.MinY = 20;
            box.MaxY = 21;
            filter.BoundingBox = box;
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List<Permit> permits = adapter.SearchPermits(filter);
            Assert.AreEqual(0, permits.Count);
        }
Пример #22
0
        private static Tuple<List<Permit>, List<Permit>> getPermitsToSync()
        {
            HashSet<string> closedPermits = new HashSet<string>();
            HashSet<string> openedPermits = new HashSet<string>();

            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();

            List<Permit> knownPermits = adapter.SearchPermits(new PermitFilter());

            string[] unactivePermits = new string[] {"CLOSED", "EXPIRED"};

            foreach (Permit permit in knownPermits)
            {
                if (unactivePermits.Contains(permit.StatusCurrent))
                {
                    closedPermits.Add(permit.PermitNum);
                }
                else
                {
                    openedPermits.Add(permit.PermitNum);
                }
            }

            List<Permit> mdcPermits = getSocrataPermits();

            List<Permit> existingPermits = new List<Permit>();
            List<Permit> newPermits = new List<Permit>();

            foreach (Permit permit in mdcPermits)
            {
                //Permit is not closed
                if (permit.PermitNum != null && !closedPermits.Contains(permit.PermitNum))
                {
                    if (openedPermits.Contains(permit.PermitNum))
                        existingPermits.Add(permit);
                    else
                        newPermits.Add(permit);
                }

            }

            return new Tuple<List<Permit>, List<Permit>>(newPermits, existingPermits);

        }
        public void TestNoFilter()
        {
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List<Permit> permits = adapter.SearchPermits(new PermitFilter());
            Assert.AreEqual(30, permits.Count);

        }
 public void TestGetBadInspection()
 {
     IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
     Inspection inspection = adapter.GetInspection("PERMNUM_15", "-1");
     Assert.IsNull(inspection);
 }
 public void TestGetPermitInspection()
 {
     IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
     List<Inspection> inspections = adapter.GetInspections("PERMNUM_15");
     Inspection refInspection = inspections[5];
     Inspection inspection = adapter.GetInspection("PERMNUM_15", refInspection.Id);
     Assert.IsNotNull(inspection);
     Assert.AreEqual(refInspection.Inspector, inspection.Inspector);
 }
        public void TestNoFilterMatchMechanical()
        {   
            PermitFilter filter = new PermitFilter();
            filter.Types = new List<TypeChoices>(new TypeChoices[] { TypeChoices.Mechanical });
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List<Permit> permits = adapter.SearchPermits(filter);
            Assert.AreEqual(6, permits.Count);

        }
 public void TestGetPermitInspections()
 {
     IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
     List<Inspection> inspections = adapter.GetInspections("PERMNUM_15");
     Assert.AreEqual(inspections.Count, 10);
 }
 public void TestGetPermitTimeline()
 {
     IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
     List<PermitStatus> timeline = adapter.GetPermitTimeline("PERMNUM_15");
     Assert.AreEqual(timeline.Count, 10);
 }
 public void TestGetBadPermit()
 {
     IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
     Permit permit = adapter.GetPermit("PERMNUM_45");
     Assert.IsNull(permit);
 }
        public void TestGetExistingPermit()
        {
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            Permit permit = adapter.GetPermit("PERMNUM_17");
            Assert.IsNotNull(permit);
            Assert.AreEqual("34RT56890317", permit.ContractorLicNum);

        }
        public void TestNoFilterMatchTimeFrameClosed()
        {
            PermitFilter filter = new PermitFilter();
            filter.TimeFrame = new Tuple<StatusChoices, DateTime, DateTime>(StatusChoices.Closed,
                Convert.ToDateTime("01/01/2013"), Convert.ToDateTime("01/01/2014"));
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List<Permit> permits = adapter.SearchPermits(filter);
            Assert.AreEqual(8, permits.Count);

        }
        public void TestNoFilterMatchStatusMultipleStatuses()
        {
            PermitFilter filter = new PermitFilter();
            filter.Status = new List<StatusChoices>(new StatusChoices[] { StatusChoices.Applied, StatusChoices.Closed });
            IOpenPermitAdapter adapter = new SQLOpenPermitAdapter();
            List<Permit> permits = adapter.SearchPermits(filter);
            Assert.AreEqual(15, permits.Count);

        }