Ejemplo n.º 1
0
            public void GetOfflineTransactionCountsFailsWhenEndDateDefaultValue()
            {
                //arrange
                var startDate = new DateTime(2014, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                var endDate = default(DateTime);
                var settlementManager = new SettlementManager();

                //act
                settlementManager.GetOfflineTransactionCounts(startDate, endDate, OfflineSourceEnum.Web);

                //assert
                Assert.Fail("Test should fail if end date is default value");
            }
Ejemplo n.º 2
0
            public void GetOfflineTransactionCountsReturnsCountCorrectly()
            {
                //arrange
                var startDate = new DateTime(2014, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                var endDate = new DateTime(2014, 2, 1, 0, 0, 0, DateTimeKind.Utc);
                
                var bookingDaoMock = MockRepository.GenerateMock<IBookingDao>();
                var bookingCounts = new List<PropertyOfflineBookingsCount>
                    {
                        new PropertyOfflineBookingsCount
                            {
                                CurrencyCode = "GBP",
                                OfflineBookingCount = 3,
                                PeriodDateTime = startDate,
                                PropertyShortname = "TestBus1",
                                TaxRegistered = false
                            },
                        new PropertyOfflineBookingsCount
                            {
                                CurrencyCode = "GBP",
                                OfflineBookingCount = 5,
                                PeriodDateTime = startDate,
                                PropertyShortname = "TestBus2",
                                TaxRegistered = false
                            }
                    };

                bookingDaoMock.Expect(bd => bd.GetPropertyOfflineBookingsCounts(Arg<DateTime>.Is.Anything,
                                                                                Arg<DateTime>.Is.Anything,
                                                                                Arg<OfflineSourceEnum>.Is.Anything))
                              .Return(bookingCounts)
                              .Repeat.Once();

                var settlementManager = new SettlementManager {BookingDao = bookingDaoMock};


                //act
                var result = settlementManager.GetOfflineTransactionCounts(startDate, endDate, OfflineSourceEnum.Web);
                
                //assert
                Assert.IsNotNull(result, "Result was null");
                Assert.AreEqual(2, result.Count, "Result collection doesn't contain the right number of elements");
                Assert.AreSame(bookingCounts, result, "Result value was not as expected");
                bookingDaoMock.VerifyAllExpectations();
            }