Пример #1
0
            public void SendRatesRestrictionUpdateWithRatesListCallPPCGateway()
            {
                //Arrange
                const string businessShortname = "TestBus2";

                var ppcGatewayMock = new Mock<IPPCGateway>();
                var roomTypeManagerStub = new Mock<IRoomTypeManager>();
                var rateCacheManagerStub = new Mock<IRateCacheManager>();

                rateCacheManagerStub.Setup(r => r.GetAllByRoomTypeAndRatePlanId(businessShortname, 1, 1, RatePlanTypeEnum.Unknown))
                    .Returns(new List<RateCache>()
                                 {
                                     new RateCache()
                                         {
                                             Rate = new decimal(1.0),
                                             Date = DateTime.Now,
                                             MinStay = 1
                                         }
                                 });

                var rateAmountUpdate = new RateRestrictionUpdate();
                rateAmountUpdate.PPCGateway = ppcGatewayMock.Object;
                rateAmountUpdate.RateCacheManager = rateCacheManagerStub.Object;
                rateAmountUpdate.RoomTypeManager = roomTypeManagerStub.Object;

                //Act
                rateAmountUpdate.SendRatesRestrictionUpdate(businessShortname, 1, 1);

                //Assert
                ppcGatewayMock.Verify(g => g.Publish(It.IsAny<IPartitionable>()), Times.AtLeastOnce);
            }
Пример #2
0
            public void SendRatesRestrictionUpdateWithEmptyRatesListDoNotCallPPCGateway()
            {
                //Arrange
                const string businessShortname = "TestBus2";

                var ppcGatewayStub = new Mock<IPPCGateway>();
                var roomTypeManagerStub = new Mock<IRoomTypeManager>();
                var rateCacheManagerStub = new Mock<IRateCacheManager>();

                rateCacheManagerStub.Setup(r => r.GetAllByRoomTypeAndRatePlanId(businessShortname, 1, 1, RatePlanTypeEnum.Unknown))
                    .Returns(new List<RateCache>());

                var rateAmountUpdate = new RateRestrictionUpdate();
                rateAmountUpdate.PPCGateway = ppcGatewayStub.Object;
                rateAmountUpdate.RateCacheManager = rateCacheManagerStub.Object;
                rateAmountUpdate.RoomTypeManager = roomTypeManagerStub.Object;

                //Act
                rateAmountUpdate.SendRatesRestrictionUpdate(businessShortname, 1, 1);

                //Assert
                ppcGatewayStub.Verify(g => g.Publish(It.IsAny<IPartitionable>()), Times.Never);
            }