public RealEstateListingPresentationModel(IRealEstateListingView view, IRealEstateService realEstateService)
        {
            RealEstate realEstate = realEstateService.GetRealEstate();

            Address       = realEstate.Address;
            County        = realEstate.County;
            State         = realEstate.State;
            Price         = realEstate.Price;
            ZipCode       = realEstate.ZipCode;
            Bedrooms      = realEstate.Bedrooms;
            Bathrooms     = realEstate.Bathrooms;
            GarageSize    = realEstate.GarageSize;
            Acreage       = realEstate.Acreage;
            Description   = realEstate.Description;
            PropertyImage = realEstate.Image;

            this.Sections = new ObservableCollection <PieSection>();
            foreach (var matching in realEstate.CriteriaMatching)
            {
                this.Sections.Add(new PieSection()
                {
                    SectionWeight = matching.CriteriaWeight, MatchingPercentage = matching.CriteriaMatchingPercentage, Description = matching.FeatureDescription
                });
            }

            this.View = view;
            this.View.SetModel(this);
        }
Ejemplo n.º 2
0
        public RealEstate GetRealEstate()
        {
            var property = new RealEstate
                               {
                                   Address = "132 Main Street",
                                   County = "Redmond",
                                   State = "WA",
                                   Price = 315000d,
                                   ZipCode = 98052,
                                   Bedrooms = 5d,
                                   Bathrooms = 2.5d,
                                   GarageSize = 2d,
                                   Acreage = 0.5d,
                                   Description =
                                       "This property redefines beauty, with ocean views, mountain views, beach views, tree views, and views of views.  In short it is spectacular.",
                                   Image = GetImage()
                               };

            property.CriteriaMatching.Add(new RealEstateFeatureMatching
            {
                FeatureDescription = "Bedrooms",
                CriteriaMatchingPercentage = 100d,
                CriteriaWeight = 1d
            });
            property.CriteriaMatching.Add(new RealEstateFeatureMatching
            {
                FeatureDescription = "Garage",
                CriteriaMatchingPercentage = 80d,
                CriteriaWeight = 0.5d
            });
            property.CriteriaMatching.Add(new RealEstateFeatureMatching
            {
                FeatureDescription = "Price",
                CriteriaMatchingPercentage = 20d,
                CriteriaWeight = 1.5d
            });
            property.CriteriaMatching.Add(new RealEstateFeatureMatching
            {
                FeatureDescription = "Acreage",
                CriteriaMatchingPercentage = 50d,
                CriteriaWeight = 0.9d
            });
            property.CriteriaMatching.Add(new RealEstateFeatureMatching
            {
                FeatureDescription = "BathRooms",
                CriteriaMatchingPercentage = 90d,
                CriteriaWeight = 0.2d
            });

            return property;
        }
        public MockRealEstateService()
        {
            getRealEstateReturnValue = new RealEstate();
            this.getRealEstateReturnValue.Image = new BitmapImage(
                new Uri("RealEstateListingViewer.Tests;Component/Resources/MockImage.jpg", UriKind.Relative));

            this.getRealEstateReturnValue.CriteriaMatching.Add(new RealEstateFeatureMatching()
                                                       {
                                                           CriteriaMatchingPercentage = 12,
                                                           CriteriaWeight = 10,
                                                           FeatureDescription = "I am a feature"
                                                       });

            this.getRealEstateReturnValue.CriteriaMatching.Add(new RealEstateFeatureMatching()
            {
                CriteriaMatchingPercentage = 5
                ,
                CriteriaWeight = 2
                ,
                FeatureDescription = "I am a feature too"
            });
        }