public void TestMappingOfPropertyPhotos() { string fakeStorageId = "StorageId"; string fakePhotoUrl = "photoURL"; Photo fakePhoto = new Photo(fakeStorageId, fakePhotoUrl); HomeFindingProperty hfp = HomeFindingPropertiesBuilder.New().First(); Property property = hfp.Property; property.Photos.Add(fakePhoto); order.HomeFinding.HomeFindingProperties.Add(hfp); HousingViewModel viewModel = new HousingViewModel(order, mapper); HousingPropertyViewModel propertyViewModel = viewModel.Properties.ElementAt(0); propertyViewModel.PropertyPhotos.Should().NotBeNull(); propertyViewModel.PropertyPhotos.Should().NotBeEmpty(); PhotoViewModel photoVM = propertyViewModel.PropertyPhotos.ElementAt(0); photoVM.PhotoUrl.Should().Be(fakePhotoUrl); photoVM.StorageId.Should().Be(fakeStorageId); }
public void GetUpcomingHomeFindingPropertiesByOrderId_ReturnsOnlyFutureProperties() { HomeFinding homeFinding = HomeFindingBuilder.New(); HomeFindingProperty yesterdayHFP = HomeFindingPropertiesBuilder.New().First(); yesterdayHFP.ViewingDate = DateTime.Now.AddDays(-1); yesterdayHFP.HomeFinding = homeFinding; HomeFindingProperty tomorrowHFP = HomeFindingPropertiesBuilder.New().First(); tomorrowHFP.ViewingDate = DateTime.Now.AddDays(1); tomorrowHFP.HomeFinding = homeFinding; HomeFindingProperty nextWeekHFP = HomeFindingPropertiesBuilder.New().First(); nextWeekHFP.ViewingDate = DateTime.Now.AddDays(7); nextWeekHFP.HomeFinding = homeFinding; HomeFindingProperty noShowingHFP = HomeFindingPropertiesBuilder.New().First(); noShowingHFP.ViewingDate = null; noShowingHFP.HomeFinding = homeFinding; var hfps = new[] { yesterdayHFP, tomorrowHFP, nextWeekHFP, noShowingHFP }; SetupRepositoryWithSource(hfps); // Act IEnumerable <HomeFindingProperty> upcomingViewings = _homeFindingPropertiesRepository.GetUpcomingHomeFindingPropertiesByHomeFindingId(homeFinding.Id); // Assert upcomingViewings.Count().Should().Be(2); upcomingViewings.Should().NotContain(yesterdayHFP); upcomingViewings.Should().NotContain(noShowingHFP); upcomingViewings.Should().Contain(tomorrowHFP); upcomingViewings.Should().Contain(nextWeekHFP); }