Ejemplo n.º 1
0
        public void GetSchedulesByFacilityAndStartDateQueryHandler_WhenQueriedForAWeeklyScheduleWithAnInvalidDate_ReturnsNoRecords()
        {
            using (var context = new ScaScheduleContext())
            {
                // arrange
                var queryHandler = new GetSchedulesByFacilityAndStartDateQueryHandler(context);

                // act
                var actual = queryHandler.Handle(new GetSchedulesByFacilityAndStartDateQuery {
                    FacilityId = 1, StartDate = new System.DateTime(2017, 1, 1)
                });

                // assert
                Assert.IsFalse(actual.Any());
            }
        }
Ejemplo n.º 2
0
        public void GetWeeklySchedulesByFacilityIdAndStartDater_WhenCalledWithAValidDate_Returns10Records()
        {
            using (var context = new ScaScheduleContext())
            {
                // arrange
                var queryHandler = new GetSchedulesByFacilityAndStartDateQueryHandler(context);

                // act
                var actual = queryHandler.Handle(new GetSchedulesByFacilityAndStartDateQuery {
                    FacilityId = 1, StartDate = new System.DateTime(2018, 1, 1)
                });

                // assert
                Assert.AreEqual(actual.Count(), 10);
            }
        }
        public void GetSchedulesByFacilityAndStartDateQueryHandler_WhenCalledWithAValidDate_Returns10Records()
        {
            // arrange
            using (var context = new ScaScheduleContext())
            {
                var handler = new GetSchedulesByFacilityAndStartDateQueryHandler(context);

                var query = new GetSchedulesByFacilityAndStartDateQuery
                {
                    FacilityId = 1,
                    StartDate  = new DateTime(2018, 1, 1)
                };

                // act
                var actual = handler.Handle(query);

                // assert
                Assert.AreEqual(actual.ToList().Count, 10);
            }
        }