public void TestWithAttendantCircumstances()
        {
            var publicPlace = new PublicPlace("sidewalk")
            {
                IsWithin = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg
            };
            var testCrime = new Misdemeanor
            {
                ActusReus = new DisorderlyConduct
                {
                    IsUnreasonablyLoud = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg
                },
                MensRea = new Recklessly
                {
                    IsDisregardOfRisk   = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg,
                    IsUnjustifiableRisk = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg
                },
                AttendantCircumstances = { publicPlace }
            };
            var testResult = testCrime.IsValid(new DavidInebriatedEg(), new DanielDrunkbuddyEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);

            publicPlace.IsAccessibleToPublic = false;
            publicPlace.Name = "private residence in the country";
            testResult       = testCrime.IsValid(new DavidInebriatedEg(), new DanielDrunkbuddyEg());
            Console.WriteLine(testCrime.ToString());
            Assert.IsFalse(testResult);
        }
        public IHttpActionResult GetRealtyTaxValue(int id)
        {
            PublicPlace place = _publicPlaceRepository.GetPublicPlace(id);

            if (place == null)
            {
                return(NotFound());
            }

            PublicPlaceGarbageCollectionResponse response = new PublicPlaceGarbageCollectionResponse();

            response.PublicPlaceId     = place.Id;
            response.GarbageCollection = place.GarbageCollection;

            return(Ok(response));
        }
        private ServiceOrder GenerateServiceOrder(ServiceOrderType type, int PublicPlaceId)
        {
            ServiceOrder order = new ServiceOrder();

            order.OrderDate = DateTime.Now;
            order.Type      = type;

            PublicPlace place = _publicPlaceRepository.GetPublicPlace(PublicPlaceId);

            if (place == null)
            {
                throw new CityServiceException(500, "Parametro 'logradouro' inválido");
            }

            order.Place = place;

            return(order);
        }
Esempio n. 4
0
 public bool Save(PublicPlace PublicPlace)
 {
     _PublicPlaceApp.InsertOrUpdate(PublicPlace);
     return(_connection.Save());
 }
Esempio n. 5
0
 public bool InsertOrUpdate(PublicPlace PublicPlace)
 {
     return(_epr.InsertOrUpdate(PublicPlace));
 }