Beispiel #1
0
            public void CreateBookingChargeWithInvalidChargeThrowsValidationException()
            {
                //Arrange
                var bookingItemManager = new BookingItemManager();

                var bookingItem = new BookingItem
                {
                    BookingId = 1,
                    EventDate = DateTime.UtcNow,
                    Charge = new Charge()
                };
                
                // Act
                bookingItemManager.CreateBookingCharge(bookingItem);

                // Assert
                Assert.Fail("No validation exception was thrown");
            }
Beispiel #2
0
            public void CreateBookingChargeCallsCorrectMethod()
            {
                //Arrange
                var bookingItemManager = new BookingItemManager();

                var bookingItem = new BookingItem
                    {
                        BookingId = 1,
                        EventDate = DateTime.UtcNow,
                        Charge = new Charge
                            {
                                Id = 1,
                                ChargeCategory = new ChargeCategory
                                    {
                                        Id = 1,
                                        Name = "Category"
                                    },
                                ChargeCostType = new ChargeCostType { Type = ChargeCostTypeEnum.Variable },
                                ChargeType = new ChargeType { Type = ChargeTypeEnum.Charge },
                                Name = "Charge"
                            }
                    };

                var bookingItemDao = MockRepository.GenerateMock<IBookingItemDao>();
                bookingItemManager.BookingItemDao = bookingItemDao;

                bookingItemDao.Expect(b => b.CreateBookingCharge(Arg<BookingItem>.Is.Anything)).WhenCalled(delegate { bookingItem.Id = 1; });

                // Act
                bookingItemManager.CreateBookingCharge(bookingItem);

                // Assert
                bookingItemDao.VerifyAllExpectations();
            }