Example #1
0
        private Order BuildOrder(bool emptyProperties = true)
        {
            Order order = OrderBuilder.New().First();

            order.Transferee     = transferee;
            order.ProgramManager = pm;
            order.Consultant     = dsc;

            HomeFinding homeFinding = HomeFindingBuilder.New();

            if (emptyProperties)
            {
                // The builder makes a single property, but we want it empty
                homeFinding.HomeFindingProperties = new Collection <HomeFindingProperty>();
            }

            order.HomeFinding = homeFinding;

            return(order);
        }
        /*-------------------------------------------------*/
        private Order BuildOrder(bool emptyProperties = true)
        {
            Order order = OrderBuilder.New().First();

            order.Transferee     = transferee;
            order.ProgramManager = pm;
            order.Consultant     = dsc;
            order.ServiceFlag    = (int)ServiceCategory.AccompaniedHomeFinding; //Has homefinding service.

            HomeFinding homeFinding = HomeFindingBuilder.New();

            if (emptyProperties)
            {
                // The builder makes a single property, but we want it empty
                homeFinding.HomeFindingProperties = new Collection <HomeFindingProperty>();
            }

            order.HomeFinding = homeFinding;

            return(order);
        }
        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);
        }