public void GivenACurrentReaRentalFileAndAnExistingListing_Parse_ReturnsTheUpdatedListing() { // Arrange. var existingListing = FakeListings.CreateAFakeRentalListing(); existingListing.Pricing.RentalPrice = 444; existingListing.Pricing.RentalPriceText = Guid.NewGuid().ToString(); existingListing.Title = Guid.NewGuid().ToString(); existingListing.Description = Guid.NewGuid().ToString(); var reaXml = File.ReadAllText(FakeDataFolder + "REA-Rental-Current.xml"); var reaXmlTransmorgrifier = new ReaXmlTransmorgrifier(); var newListing = reaXmlTransmorgrifier.Parse(reaXml) .Listings .First() .Listing as RentalListing; // Arrange. var result = reaXmlTransmorgrifier.Parse(reaXml, existingListing); // Assert. var listing = result.Listings.First().Listing as RentalListing; listing.StatusType.ShouldBe(existingListing.StatusType); listing.Pricing.RentalPrice.ShouldBe(newListing.Pricing.RentalPrice); listing.Pricing.RentalPriceText.ShouldBe(newListing.Pricing.RentalPriceText); listing.Title.ShouldBe(newListing.Title); listing.Description.ShouldBe(newListing.Description); }
public void GivenTheFileREARentalCurrent_Parse_ReturnsARentalAvailableListing(string fileName) { // Arrange. var expectedListing = FakeListings.CreateAFakeRentalListing(); var reaXml = File.ReadAllText(FakeDataFolder + fileName); var reaXmlTransmorgrifier = new ReaXmlTransmorgrifier(); // Act. var result = reaXmlTransmorgrifier.Parse(reaXml); // Assert. AssertRentalListing(result, expectedListing); }
public void GivenTheFileREARentalCurrentWithNoBond_Parse_ReturnsARentalAvailableListing() { // Arrange. var expectedListing = FakeListings.CreateAFakeRentalListing(); expectedListing.Pricing.Bond = null; var reaXml = File.ReadAllText(FakeDataFolder + "REA-Rental-Current-WithNoBond.xml"); var reaXmlTransmorgrifier = new ReaXmlTransmorgrifier(); // Act. var result = reaXmlTransmorgrifier.Parse(reaXml); // Assert. AssertRentalListing(result, expectedListing); }
public void GivenANonCurrentReaRentalFileAndAnExistingListing_Parse_ReturnsTheUpdatedListing(string fileName, StatusType expectedStatusType) { // Arrange. var existingListing = FakeListings.CreateAFakeRentalListing(); var reaXml = File.ReadAllText(FakeDataFolder + fileName); var reaXmlTransmorgrifier = new ReaXmlTransmorgrifier(); // Arrange. var result = reaXmlTransmorgrifier.Parse(reaXml, existingListing); // Assert. var listing = result.Listings.First().Listing as RentalListing; listing.StatusType.ShouldBe(expectedStatusType); var validator = new RentalListingValidator(); var validationResult = validator.Validate(listing, ruleSet: RentalListingValidator.StrictRuleSet); validationResult.IsValid.ShouldBeTrue(); }