private static Listing CreateListing(CategoryType categoryType)
        {
            Listing listing;

            switch (categoryType)
            {
            case CategoryType.Sale:
                listing = new ResidentialListing();
                break;

            case CategoryType.Rent:
                listing = new RentalListing();
                break;

            case CategoryType.Land:
                listing = new LandListing();
                break;

            case CategoryType.Rural:
                listing = new RuralListing();
                break;

            default:
                // Not sure if we should do some logging here?
                listing = null;
                break;
            }

            return(listing);
        }
        public static void AssertRuralListing(RuralListing source,
                                              RuralListing destination)
        {
            ListingAssertHelpers.AssertCommonData(source, destination);
            BuildingDetailsAssertHelpers.AssertBuildingDetails(source.BuildingDetails, destination.BuildingDetails);

            source.AuctionOn.ShouldBe(destination.AuctionOn);
        }
        protected static RuralListing FakeRuralListing(StatusType statusType)
        {
            var listing = new RuralListing();

            SetupListing(listing, statusType);

            return(listing);
        }
        private static void ExtractRuralData(RuralListing listing, XElement document, CultureInfo cultureInfo)
        {
            document.ShouldNotBe(null);

            listing.CategoryType = ExtractRuralCategoryType(document);
            listing.Pricing      = ExtractSalePricing(document, cultureInfo);
            listing.AuctionOn    = ExtractAuction(document);
        }
Exemplo n.º 5
0
        public static ValidationResult Validate(RuralListing ruralListing,
                                                string ruleSet = RuralListingValidator.NormalRuleSet)
        {
            var validator = new RuralListingValidator();

            return(string.IsNullOrWhiteSpace(ruleSet)
                ? validator.Validate(ruralListing)
                : validator.Validate(ruralListing, ruleSet: ruleSet));
        }
 private static void AssertRuralListing(ParsedResult result,
                                        RuralListing expectedListing)
 {
     result.ShouldNotBeNull();
     result.Listings.Count.ShouldBe(1);
     result.Errors.Count.ShouldBe(0);
     result.UnhandledData.Count.ShouldBe(0);
     RuralListingAssertHelpers.AssertRuralListing(result.Listings.First().Listing as RuralListing,
                                                  expectedListing);
 }
Exemplo n.º 7
0
 private static void SetRuralFeatures(RuralListing listing)
 {
     listing.RuralFeatures = new RuralFeatures
     {
         AnnualRainfall   = "250 mm per annum",
         CarryingCapacity = "400 Deer or 100 head of breeding Cattle",
         Fencing          = "Boundary and internal fencing all in good condition",
         Improvements     = "Shearing shed, barn and machinery shed.",
         Irrigation       = "Electric pump from dam and bore.",
         Services         = "Power, telephone, airstrip, school bus, mail."
     };
 }
Exemplo n.º 8
0
            private static void AssertRuralSoldListing(RuralListing listing, bool isSoldPriceVisibile = true)
            {
                listing.AgencyId.ShouldBe("XNWXNW");
                listing.Id.ShouldBe("Rural-Sold-ABCD1234");
                listing.StatusType.ShouldBe(StatusType.Sold);

                listing.Pricing.SoldPrice.ShouldBe(85000m);
                listing.Pricing.SoldPriceText.ShouldBe(isSoldPriceVisibile
                    ? null
                    : "Sold Price Witheld");
                listing.Pricing.SoldOn.ShouldBe(new DateTime(2009, 01, 10, 12, 30, 00));
            }
Exemplo n.º 9
0
        public static RuralListing RuralListing(bool isClearAllIsModified = true)
        {
            var listing = new RuralListing
            {
                CategoryType  = RuralListingCategoryType.Horticulture,
                AuctionOn     = new DateTime(2015, 5, 23),
                CouncilRates  = "some council rates",
                RuralFeatures = new RuralFeatures
                {
                    AnnualRainfall   = "some rain",
                    CarryingCapacity = "some carrying capacity",
                    Fencing          = "some fencing",
                    Improvements     = "lots of improvements",
                    Irrigation       = "some irrigation",
                    Services         = "a number of services",
                    SoilTypes        = "dirty soil"
                },
                Pricing = new SalePricing
                {
                    IsUnderOffer  = true,
                    SalePrice     = 12345.66m,
                    SalePriceText = "house for sale",
                    SoldOn        = new DateTime(2015, 6, 1),
                    SoldPrice     = 45432.99m,
                    SoldPriceText = "just sold woot!"
                },
                BuildingDetails = new BuildingDetails
                {
                    Area = new UnitOfMeasure
                    {
                        Type  = "Some type",
                        Value = 1.2345m
                    },
                    EnergyRating = 111.222m,
                }
            };

            if (isClearAllIsModified)
            {
                listing.ClearAllIsModified();
            }
            return(listing);
        }
Exemplo n.º 10
0
            private static void AssertRuralCurrentListing(RuralListing listing)
            {
                listing.AgencyId.ShouldBe("XNWXNW");
                listing.Id.ShouldBe("Rural-Current-ABCD1234");
                listing.StatusType.ShouldBe(StatusType.Current);
                listing.CategoryType.ShouldBe(CategoryType.Cropping);

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

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

                listing.Title.ShouldBe("SHOW STOPPER!!!");
                listing.Description.ShouldStartWith("Don't pass up an opportunity like this! First to inspect will buy! Close to local amen");

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

                listing.LandDetails.Area.Value.ShouldBe(50);
                listing.LandDetails.Area.Type.ShouldBe("acre");
                listing.LandDetails.Frontage.Value.ShouldBe(500);
                listing.LandDetails.Frontage.Type.ShouldBe("meter");
                listing.LandDetails.Depth.Value.ShouldBe(400);
                listing.LandDetails.Depth.Type.ShouldBe("meter");
                listing.LandDetails.Depth.Side.ShouldBe("rear");

                listing.Inspections.Count.ShouldBe(2);

                listing.Images.Count.ShouldBe(2);
                listing.FloorPlans.Count.ShouldBe(2);

                listing.AuctionOn.ShouldBe(new DateTime(2009, 01, 24, 14, 30, 00));
            }
Exemplo n.º 11
0
        public static RuralListing CreateAFakeRuralListing(string id = "Rural-Current-ABCD1234",
                                                           PropertyType propertyType = PropertyType.House)
        {
            var listing = new RuralListing()
            {
                Id = id
            };

            FakeCommonListingHelpers.SetCommonListingData(listing);
            listing.Features.Tags.Remove("houseAndLandPackage");
            listing.Features.Tags.Remove("isANewConstruction");

            FakeCommonListingHelpers.SetBuildingDetails(listing);
            FakeCommonListingHelpers.SetSalePrice(listing);

            SetRuralFeatures(listing);

            listing.AuctionOn    = new DateTime(2009, 1, 24, 14, 30, 00, DateTimeKind.Utc);
            listing.CategoryType = Core.Rural.CategoryType.Cropping;
            listing.CouncilRates = "$2,200 per annum";

            return(listing);
        }