コード例 #1
0
        public void If_ServiceRateDiscount_DOES_exist_for_Customer_and_ServiceRate_it_should_be_assigned()
        {
            const int defaultRate  = 15;
            const int adjustedRate = 10;

            // Arrange
            var customer = new Customer(Uow)
            {
                DateOfBirth = new DateTime(1990, 1, 1)
            };
            var serviceType = new ServiceType(Uow)
            {
                DefaultRate = defaultRate
            };
            var serviceRateDiscount = new ServiceRateDiscount(Uow)
            {
                ServiceType = serviceType, Customer = customer, AdjustedRate = adjustedRate
            };

            Uow.CommitChanges();

            // Act
            var transaction = new Transaction(Uow)
            {
                Customer = customer, ServiceType = serviceType
            };

            // Assert
            transaction.ServiceRateDiscount.ShouldBe(serviceRateDiscount);
            transaction.TransactionPrice.ShouldBe(adjustedRate);
        }
コード例 #2
0
        public void When_GetSingleServiceRateDiscountResult_and_discount_DOES_exist_it_should_return_it()
        {
            const int defaultRate  = 15;
            const int adjustedRate = 10;

            // Arrange
            var customer = new Customer(Uow)
            {
                DateOfBirth = new DateTime(1990, 1, 1)
            };
            var serviceType = new ServiceType(Uow)
            {
                DefaultRate = defaultRate
            };
            var serviceRateDiscount = new ServiceRateDiscount(Uow)
            {
                ServiceType = serviceType, Customer = customer, AdjustedRate = adjustedRate
            };

            Uow.CommitChanges();

            // Act & Assert
            GetSingleServiceRateDiscountResult(Uow, serviceType, customer).Value.ShouldBe(serviceRateDiscount);
        }