Esempio n. 1
0
        public void Copy(Features newFeatures)
        {
            if (newFeatures == null)
            {
                throw new ArgumentNullException("newFeatures");
            }

            if (newFeatures.IsBedroomsModified)
            {
                Bedrooms = newFeatures.Bedrooms;
            }

            if (newFeatures.IsBathroomsModified)
            {
                Bathrooms = newFeatures.Bathrooms;
            }

            if (newFeatures.IsToiletsModified)
            {
                Toilets = newFeatures.Toilets;
            }

            if (newFeatures.IsCarParkingModified)
            {
                if (newFeatures.CarParking == null)
                {
                    CarParking = null;
                }
                else
                {
                    if (CarParking == null)
                    {
                        CarParking = new CarParking();
                    }

                    if (newFeatures.CarParking.IsModified)
                    {
                        CarParking.Copy(newFeatures.CarParking);
                    }

                    IsCarParkingModified = true;
                }
            }

            if (newFeatures.IsEnsuitesModified)
            {
                Ensuites = newFeatures.Ensuites;
            }

            if (newFeatures.IsLivingAreasModified)
            {
                LivingAreas = newFeatures.LivingAreas;
            }

            if (newFeatures.IsTagsModified)
            {
                Tags = newFeatures.Tags;
            }
        }
Esempio n. 2
0
        public void ClearAllIsModified()
        {
            if (CarParking != null)
            {
                CarParking.ClearAllIsModified();
            }
            IsCarParkingModified = false;

            IsBedroomsModified    = false;
            IsBathroomsModified   = false;
            IsToiletsModified     = false;
            IsCarParkingModified  = false;
            IsEnsuitesModified    = false;
            IsLivingAreasModified = false;
            IsTagsModified        = false;
        }
        public void Copy(CarParking newCarParking)
        {
            if (newCarParking == null)
            {
                throw new ArgumentNullException("newCarParking");
            }

            if (newCarParking.IsGaragesModified)
            {
                Garages = newCarParking.Garages;
            }

            if (newCarParking.IsCarportsModified)
            {
                Carports = newCarParking.Carports;
            }

            if (newCarParking.IsOpenSpacesModified)
            {
                OpenSpaces = newCarParking.OpenSpaces;
            }
        }
Esempio n. 4
0
        public void Copy(CarParking newCarParking)
        {
            if (newCarParking == null)
            {
                throw new ArgumentNullException("newCarParking");
            }

            if (newCarParking.IsGaragesModified)
            {
                Garages = newCarParking.Garages;
            }

            if (newCarParking.IsCarportsModified)
            {
                Carports = newCarParking.Carports;
            }

            if (newCarParking.IsOpenSpacesModified)
            {
                OpenSpaces = newCarParking.OpenSpaces;
            }
        }
            private static void AssertCarParking(CarParking carParking, 
                CarParking optionalCarParkingData,
                bool isModified)
            {
                carParking.Garages.ShouldBe(optionalCarParkingData != null
                    ? optionalCarParkingData.Garages
                    : 3);
                carParking.IsGaragesModified.ShouldBe(isModified);

                carParking.Carports.ShouldBe(optionalCarParkingData != null
                    ? optionalCarParkingData.Carports
                    : 2);
                carParking.IsCarportsModified.ShouldBe(isModified);

                carParking.OpenSpaces.ShouldBe(optionalCarParkingData != null
                    ? optionalCarParkingData.OpenSpaces
                    : 0);
                carParking.IsOpenSpacesModified.ShouldBe(optionalCarParkingData != null &&
                    optionalCarParkingData.OpenSpaces != 0
                    ? optionalCarParkingData.IsOpenSpacesModified
                    : isModified);

                carParking.IsModified.ShouldBe(isModified);
            }
            private static void AssertFeatures(Features features,
                IList<string> tags,
                bool isModified,
                int bedroomsCount = 0,
                int bathroomCount = 0,
                int ensuitesCount = 0,
                int toiletsCount = 0,
                int livingAreasCount = 0,
                CarParking carParking = null)
            {
                features.Bedrooms.ShouldBe(bedroomsCount);
                features.IsBedroomsModified.ShouldBe(isModified);
                features.Bathrooms.ShouldBe(bathroomCount);
                features.IsBathroomsModified.ShouldBe(isModified);
                features.Ensuites.ShouldBe(ensuitesCount);
                features.IsEnsuitesModified.ShouldBe(isModified);
                features.Toilets.ShouldBe(toiletsCount);
                features.IsToiletsModified.ShouldBe(isModified);
                features.LivingAreas.ShouldBe(livingAreasCount);
                features.IsLivingAreasModified.ShouldBe(isModified);

                if (tags != null)
                {
                    AssertTags(features.Tags, tags);
                }

                if (features.CarParking != null)
                {
                    AssertCarParking(features.CarParking, carParking, isModified);
                }
                features.IsCarParkingModified.ShouldBe(isModified);

                features.IsTagsModified.ShouldBe(isModified);
            }
            private static void AssertLandCurrentListing(LandListing listing,
                LandCategoryType landCategoryType = LandCategoryType.Residential,
                IList<string> tags = null,
                string streetNumber = "LOT 12/39",
                CarParking carParking = null,
                bool isModified = true)
            {
                listing.AgencyId.ShouldBe("XNWXNW");
                listing.Id.ShouldBe("Land-Current-ABCD1234");
                listing.StatusType.ShouldBe(StatusType.Current);
                listing.CategoryType.ShouldBe(landCategoryType);

                listing.Agents.Count.ShouldBe(1);
                listing.Agents[0].Name.ShouldBe("Mr. John Doe");
                listing.Agents[0].Communications.Count.ShouldBe(3);

                listing.Address.StreetNumber.ShouldBe(streetNumber);
                listing.Address.Street.ShouldBe("Main Road");
                listing.Address.Suburb.ShouldBe("RICHMOND");
                listing.Address.IsStreetDisplayed.ShouldBe(true);

                listing.Pricing.IsUnderOffer.ShouldBe(false);
                listing.Pricing.SalePrice.ShouldBe(80000);
                listing.Pricing.SalePriceText.ShouldBe("To suit buyers 60K+");

                listing.Estate.Name.ShouldBe("Panorama");
                listing.Estate.Stage.ShouldBe("5");

                listing.LandDetails.Area.Type.ShouldBe("square");
                listing.LandDetails.Area.Value.ShouldBe(60m);
                listing.LandDetails.Frontage.Type.ShouldBe("meter");
                listing.LandDetails.Frontage.Value.ShouldBe(20m);
                listing.LandDetails.Depths[0].Type.ShouldBe("meter");
                listing.LandDetails.Depths[0].Value.ShouldBe(30m);
                listing.LandDetails.Depths[0].Side.ShouldBe("rear");
                listing.LandDetails.CrossOver.ShouldBe("left");

                listing.Images.Count.ShouldBe(2);
                listing.Images[0].Order.ShouldBe(1);
                listing.Images[0].Url.ShouldBe("http://www.realestate.com.au/tmp/imageM.jpg");

                listing.FloorPlans.Count.ShouldBe(2);
                listing.FloorPlans[0].Order.ShouldBe(1);
                listing.FloorPlans[0].Url.ShouldBe("http://www.realestate.com.au/tmp/floorplan1.gif");

                listing.AuctionOn.ShouldBe(new DateTime(2009, 1, 24, 12, 30, 00));

                AssertFeatures(listing.Features, 
                    tags, 
                    carParking:carParking,
                    isModified: isModified);
            }
        public void Copy(Features newFeatures)
        {
            if (newFeatures == null)
            {
                throw new ArgumentNullException("newFeatures");
            }

            if (newFeatures.IsBedroomsModified)
            {
                Bedrooms = newFeatures.Bedrooms;
            }

            if (newFeatures.IsBathroomsModified)
            {
                Bathrooms = newFeatures.Bathrooms;
            }

            if (newFeatures.IsToiletsModified)
            {
                Toilets = newFeatures.Toilets;
            }

            if (newFeatures.IsCarParkingModified)
            {
                if (newFeatures.CarParking == null)
                {
                    CarParking = null;
                }
                else
                {
                    if (CarParking == null)
                    {
                        CarParking = new CarParking();
                    }

                    if (newFeatures.CarParking.IsModified)
                    {
                        CarParking.Copy(newFeatures.CarParking);
                    }

                    IsCarParkingModified = true;
                }
            }

            if (newFeatures.IsEnsuitesModified)
            {
                Ensuites = newFeatures.Ensuites;
            }

            if (newFeatures.IsLivingAreasModified)
            {
                LivingAreas = newFeatures.LivingAreas;
            }

            if (newFeatures.IsTagsModified)
            {
                Tags = newFeatures.Tags;
            }
        }