public void Submitted_Property_With_Amenities_Returns_Property_Description_Including_Amenity_List()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.House,
                Amenities =
                    new List<Amenity>
                    {
                        new Amenity {AmenityType = AmenityType.Shopping, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Restaurants, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Bars, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Cafes, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.TrainStation, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.BusStop, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Schools, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Parks, AmenityValue = "Yes"},
                    }
            };

            //Act
            var description = property.BuildPropertyDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should()
                .Be(
                    "No upfront rent, no upfront fees and no deposit needed. LetMe are proud to present this House.\r\nThe property is located near to the following amenities:\r\n- Shopping\r\n- Restaurants\r\n- Bars\r\n- Cafes\r\n- Train Station\r\n- Bus Stop\r\n- Schools\r\n- Parks\r\n");
        }
コード例 #2
0
 public static Property Build(SubmittedProperty submittedProperty)
 {
     return new Property
     {
         PropertyReference = submittedProperty.PropertyReference, //we set this to maintain the history in CRM
         PropertyType = submittedProperty.PropertyType,
         PropertyStatus = Status.Available,
         AddressLine1 = submittedProperty.AddressLine1,
         AddressLine2 = submittedProperty.AddressLine2,
         AddressLine3 = submittedProperty.AddressLine3,
         AddressLine4 = submittedProperty.AddressLine4,
         County = submittedProperty.County,
         Postcode = submittedProperty.Postcode,
         PropertyDescription = submittedProperty.PropertyDescription,
         ShortDescription = submittedProperty.ShortDescription,
         StartDate = submittedProperty.AvailableFrom,
         MonthlyCost = submittedProperty.MonthlyCost,
         MonthlyPrice = MapToPrice(submittedProperty.MonthlyPrice, submittedProperty.LandlordValuation),
         Availability = submittedProperty.Availability,
         DealType = submittedProperty.DealType,
         PropertyDetails =  PropertyDetailFactory.Build(submittedProperty.Features),
         PropertyPhotos = PhotoFactory.Build(submittedProperty.Uploads),
         PropertyVideos = VideoFactory.Build(submittedProperty.Uploads),
         Certificates = CertificateFactory.Build(submittedProperty.Uploads)
     };
 }
コード例 #3
0
 public Description GenerateDescription(SubmittedProperty submittedProperty, List<Detail> content)
 {
     return new Description
     {
         ShortDescription = submittedProperty.BuildShortDescription(),
         PropertyDescription = submittedProperty.BuildPropertyDescription(),
     };
 }
        public void Empty_Submitted_Property_Returns_Property_Description()
        {
            //Arrange
            var property = new SubmittedProperty();

            //Act
            var description = property.BuildPropertyDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should()
                .Be("No upfront rent, no upfront fees and no deposit needed. LetMe are proud to present this Property.\r\n");
        }
コード例 #5
0
        public bool CreatePropertySubmission(string landlordReference, SubmittedProperty submittedProperty)
        {
            var landlord = _propertiesContext.Landlords.Active()
                .Include(l => l.SubmittedProperties)
                .FirstOrDefault(l => l.LandlordReference == landlordReference);

            if (landlord.IsNull())
                return false;

            landlord.SubmittedProperties.Add(submittedProperty);

            return _propertiesContext.SaveChanges() > 0;
        }
        public void Submitted_Property_With_Bath_Feature_Returns_Property_Description_Including_Baths()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.House,
                Features =
                    new List<Feature> { new Feature { FeatureType = FeatureType.NumberOfBathrooms, FeatureValue = "2" } }
            };

            //Act
            var description = property.BuildPropertyDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should()
                .Be("No upfront rent, no upfront fees and no deposit needed. LetMe are proud to present this 2 Bathroom House.\r\n");
        }
        public void Bedroom_But_No_Bathroom_Feature_Generates_Short_Description_Including_No_Of_Bedrooms()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.Flat,
                Features =
                    new List<Feature> {new Feature {FeatureType = FeatureType.NumberOfBedrooms, FeatureValue = "2"}}

            };

            //Act
            var description = property.BuildShortDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should().EndWith("2 Bedroom Flat.");
        }
        public void Multiple_Occupancy_And_Bedroom_And_Bathroom_Feature_Generates_Short_Decsription_Including_Beds_And_Baths()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.Flat,
                Features =
                    new List<Feature>
                    {
                        new Feature { FeatureType = FeatureType.NumberOfBedrooms, FeatureValue = "2" },
                        new Feature { FeatureType = FeatureType.NumberOfBathrooms, FeatureValue = "2" },
                        new Feature { FeatureType = FeatureType.MultipleOccupancy, FeatureValue = "Yes" }
                    }
            };

            //Act
            var description = property.BuildShortDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should().EndWith("Room in a 2 Bedroom, 2 Bathroom Flat.");
        }
        public void Submitted_Property_With_Property_Type_Returns_Property_Description_Including_Type()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.House
            };

            //Act
            var description = property.BuildPropertyDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should()
                .Be("No upfront rent, no upfront fees and no deposit needed. LetMe are proud to present this House.\r\n");
        }
        public void Submitted_Property_With_Features_Returns_Property_Description_Including_Feature_List()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.House,
                Features =
                    new List<Feature>
                    {
                        new Feature {FeatureType = FeatureType.Garden, FeatureValue = "Full Double Glazing"},
                        new Feature {FeatureType = FeatureType.Parking, FeatureValue = "Garage"},
                        new Feature {FeatureType = FeatureType.WhiteGoods, FeatureValue = "Yes"},
                        new Feature {FeatureType = FeatureType.Furnishing, FeatureValue = "Fully"},
                        new Feature {FeatureType = FeatureType.Pets, FeatureValue = "Small Pets"},
                        new Feature {FeatureType = FeatureType.DecorativeCondition, FeatureValue = "Good"},
                        new Feature {FeatureType = FeatureType.Glazing, FeatureValue = "Full Double Glazing"},
                        new Feature {FeatureType = FeatureType.Heating, FeatureValue = "Gas"},
                    }
            };

            //Act
            var description = property.BuildPropertyDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should()
                .Be(
                    "No upfront rent, no upfront fees and no deposit needed. LetMe are proud to present this House.\r\nThe property benefits from the following features:\r\n- Full Double Glazing\r\n- Garage\r\n- Whitegoods Included\r\n- Fully Furnished\r\n- Small Pets Allowed\r\n- Good Condition\r\n- Full Double Glazing\r\n- Gas Central Heating\r\n");
        }
        public void Submitted_Property_With_Features_And_Amenities_Returns_Property_Description_Including_Features_And_Amenity_List()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.House,
                Features =
                    new List<Feature>
                    {
                        new Feature { FeatureType = FeatureType.MultipleOccupancy, FeatureValue = "Yes" },
                        new Feature { FeatureType = FeatureType.NumberOfBedrooms, FeatureValue = "3" },
                        new Feature { FeatureType = FeatureType.NumberOfBathrooms, FeatureValue = "2" },
                        new Feature {FeatureType = FeatureType.Garden, FeatureValue = "Full Double Glazing"},
                        new Feature {FeatureType = FeatureType.Parking, FeatureValue = "Garage"},
                        new Feature {FeatureType = FeatureType.WhiteGoods, FeatureValue = "Yes"},
                        new Feature {FeatureType = FeatureType.Furnishing, FeatureValue = "Fully"},
                        new Feature {FeatureType = FeatureType.Pets, FeatureValue = "Small Pets"},
                        new Feature {FeatureType = FeatureType.DecorativeCondition, FeatureValue = "Good"},
                        new Feature {FeatureType = FeatureType.Glazing, FeatureValue = "Full Double Glazing"},
                        new Feature {FeatureType = FeatureType.Heating, FeatureValue = "Gas"},
                    },
                Amenities =
                    new List<Amenity>
                    {
                        new Amenity {AmenityType = AmenityType.Shopping, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Restaurants, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Bars, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Cafes, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.TrainStation, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.BusStop, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Schools, AmenityValue = "Yes"},
                        new Amenity {AmenityType = AmenityType.Parks, AmenityValue = "Yes"},
                    }
            };

            //Act
            var description = property.BuildPropertyDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should()
                .Be(
                    "No upfront rent, no upfront fees and no deposit needed. LetMe are proud to present this Room in a 3 Bedroom, 2 Bathroom House.\r\nThe property benefits from the following features:\r\n- Full Double Glazing\r\n- Garage\r\n- Whitegoods Included\r\n- Fully Furnished\r\n- Small Pets Allowed\r\n- Good Condition\r\n- Full Double Glazing\r\n- Gas Central Heating\r\nThe property is located near to the following amenities:\r\n- Shopping\r\n- Restaurants\r\n- Bars\r\n- Cafes\r\n- Train Station\r\n- Bus Stop\r\n- Schools\r\n- Parks\r\n");
        }
コード例 #12
0
        public string CreatePropertySubmission(string landlordReference, SubmittedProperty submittedProperty)
        {
            Check.If(landlordReference).IsNotNullOrEmpty();
            Check.If(submittedProperty).IsNotNull();

            var result = _propertySubmissionRepository.CreatePropertySubmission(landlordReference,
                submittedProperty.CreateReference(_referenceGenerator));

            return result ? submittedProperty.SubmittedPropertyReference : null;
        }
コード例 #13
0
        public bool UpdatePropertySubmission(string landlordReference, string submittedPropertyReference,
            SubmittedProperty submittedProperty)
        {
            Check.If(landlordReference).IsNotNullOrEmpty();
            Check.If(submittedPropertyReference).IsNotNullOrEmpty();
            Check.If(submittedProperty).IsNotNull();

            return _propertySubmissionRepository.UpdatePropertySubmission(landlordReference, submittedPropertyReference,
                submittedProperty);
        }
コード例 #14
0
        public bool UpdatePropertySubmission(string landlordReference, string submittedPropertyReference,
            SubmittedProperty submittedProperty)
        {
            var landlord = _propertiesContext.Landlords.Active()
                 .Include(l => l.SubmittedProperties)
                 .FirstOrDefault(l => l.LandlordReference == landlordReference);

            var existingSubmittedProperty =
                landlord?.SubmittedProperties.FirstOrDefault(
                    s => s.SubmittedPropertyReference == submittedPropertyReference);

            if (existingSubmittedProperty.IsNull())
                return false;

            var isDirty = _submittedPropertyMapper.Map(submittedProperty, existingSubmittedProperty);

            if (isDirty)
                existingSubmittedProperty.MarkRevised();

            return !isDirty || _propertiesContext.SaveChanges() > 0;
        }
 public bool UpdatePropertySubmission(string landlordReference, string submittedPropertyReference,
     SubmittedProperty submittedProperty)
 {
     return _propertyService.UpdatePropertySubmission(landlordReference, submittedPropertyReference,
         submittedProperty);
 }
 public string CreatePropertySubmission(string landlordReference, SubmittedProperty submittedProperty)
 {
     return _propertyService.CreatePropertySubmission(landlordReference, submittedProperty);
 }
        public void No_Bedroom_Or_Bathroom_Feature_Generates_Short_Description()
        {
            //Arrange
            var property = new SubmittedProperty
            {
                PropertyType = PropertyType.Flat
            };

            //Act
            var description = property.BuildShortDescription();

            //Assert
            description.Should().NotBeNullOrEmpty();
            description.Should().EndWith("Flat.");
        }