コード例 #1
0
        public void FailInGetLodgingsWithReservesInternalErrorTest()
        {
            var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict);

            lodgingRepositoryMock.Setup(l => l.GetLodgingsWithReserves(It.IsAny <Guid>(), It.IsAny <DateTime>(), It.IsAny <DateTime>())).Throws(new ServerException());
            LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object);

            DateTime       dateCheckIn  = new DateTime(2020, 05, 10);
            DateTime       dateCheckOut = new DateTime(2020, 06, 10);
            List <Lodging> resultOfGetLodgingsWithReserves = lodgingLogic.GetLodgingsWithReservesBetweenDates(touristSpotOfPuntaDelEste.Id, dateCheckIn, dateCheckOut);
        }
コード例 #2
0
        public void GetLodgingsWithReservesBetweenDatesTestOK()
        {
            lodging.TouristSpot = touristSpotOfPuntaDelEste;
            List <Lodging> listOfLodgings = new List <Lodging>()
            {
                lodging, lodgingConrad
            };

            var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict);

            lodgingRepositoryMock.Setup(l => l.GetLodgingsWithReserves(It.IsAny <Guid>(), It.IsAny <DateTime>(), It.IsAny <DateTime>())).Returns(listOfLodgings);
            LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object);

            DateTime       dateCheckIn  = new DateTime(2020, 05, 10);
            DateTime       dateCheckOut = new DateTime(2020, 06, 10);
            List <Lodging> resultOfGetLodgingsWithReserves = lodgingLogic.GetLodgingsWithReservesBetweenDates(touristSpotOfPuntaDelEste.Id, dateCheckIn, dateCheckOut);

            lodgingRepositoryMock.VerifyAll();
            CollectionAssert.AreEqual(listOfLodgings, resultOfGetLodgingsWithReserves);
        }