コード例 #1
0
        public void It_should_return_correct_value_for_training_with_side_costs()
        {
            // Given
            const decimal accommodationCost = 200;
            const decimal transportCost     = 300;

            var sideCosts = new SideCosts
            {
                AccommodationCost         = accommodationCost,
                DailyAllowanceCost        = transportCost,
                IncludeAccommodationCost  = true,
                IncludeDailyAllowanceCost = true
            };

            var training = new WishListItem(
                WishListItemType.Training,
                BasePrice,
                sideCosts: sideCosts);

            const decimal expectedResult = BasePrice + accommodationCost + transportCost;

            // When
            var result = training.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(expectedResult));
        }
コード例 #2
0
        public void It_should_return_correct_value_for_exam_with_side_costs(
            int aproachNumber,
            decimal expectedPriceMultiplicator)
        {
            // Given
            const decimal accommodationCost = 200;
            const decimal transportCost     = 300;

            var sideCosts = new SideCosts
            {
                AccommodationCost         = accommodationCost,
                DailyAllowanceCost        = transportCost,
                IncludeAccommodationCost  = true,
                IncludeDailyAllowanceCost = true
            };

            var exam = new WishListItem(
                WishListItemType.Exam,
                BasePrice,
                VendorName,
                approachNumber: aproachNumber,
                sideCosts: sideCosts);

            var expectedExamPrice  = BasePrice * expectedPriceMultiplicator;
            var expectedTotalPrice = expectedExamPrice + accommodationCost + transportCost;

            // When
            var result = exam.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(expectedTotalPrice));
        }
コード例 #3
0
        public void It_should_return_correct_value_for_foreing_conference_with_side_costs()
        {
            // Given
            const decimal accommodationCost = 200;
            const decimal transportCost     = 300;

            var sideCosts = new SideCosts
            {
                AccommodationCost         = accommodationCost,
                DailyAllowanceCost        = transportCost,
                IncludeAccommodationCost  = true,
                IncludeDailyAllowanceCost = true
            };

            var conference = new WishListItem(
                WishListItemType.Conference,
                BasePrice,
                location: LocationType.Foreign,
                sideCosts: sideCosts);

            const decimal conferenceCost = BasePrice * ForeignConferenceMultiplicator;
            const decimal expectedResult = conferenceCost + accommodationCost + transportCost;

            // When
            var result = conference.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(expectedResult));
        }
コード例 #4
0
        public void It_should_return_correct_value_for_training_without_side_costs()
        {
            // Given
            var training = new WishListItem(
                WishListItemType.Training,
                BasePrice);

            // When
            var result = training.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(BasePrice));
        }
コード例 #5
0
        public void It_should_return_correct_value_for_non_foreign_conference_without_side_costs(LocationType location)
        {
            // Given
            var conference = new WishListItem(
                WishListItemType.Conference,
                BasePrice,
                location: location);

            // When
            var result = conference.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(BasePrice));
        }
        public void It_should_return_correct_value_for_vendor_without_discount()
        {
            // Given
            const string vendorName = "Vendor name";
            var          license    = new WishListItem(
                WishListItemType.ELearningLicense,
                BasePrice,
                vendorName);

            // When
            var result = license.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(BasePrice));
        }
        public void It_should_return_correct_value_for_vendor_with_discount(string vendorName)
        {
            // Given
            var expectedResult    = BasePrice - BasePrice * _vendorNamesWithDiscounts[vendorName];
            var educationMaterial = new WishListItem(
                WishListItemType.EducationMaterial,
                BasePrice,
                vendorName,
                vendorNamesWithDiscounts: _vendorNamesWithDiscounts);

            // When
            var result = educationMaterial.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(expectedResult));
        }
コード例 #8
0
        public void It_should_return_correct_value_for_foreign_conference_without_side_costs()
        {
            // Given
            var conference = new WishListItem(
                WishListItemType.Conference,
                BasePrice,
                location: LocationType.Foreign);

            const decimal expectedResult = BasePrice * ForeignConferenceMultiplicator;

            // When
            var result = conference.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(expectedResult));
        }
コード例 #9
0
        public void It_should_return_correct_value_for_exam_without_side_costs(
            int aproachNumber,
            decimal expectedPriceMultiplicator)
        {
            // Given
            var exam = new WishListItem(
                WishListItemType.Exam,
                BasePrice,
                VendorName,
                approachNumber: aproachNumber);

            var expectedResult = BasePrice * expectedPriceMultiplicator;

            // When
            var result = exam.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(expectedResult));
        }
        public void It_should_return_correct_value_for_license_with_long_duration()
        {
            // Given
            var          startDate  = new DateTime(DateTime.Now.Year, 1, 1);
            var          endDate    = new DateTime(DateTime.Now.Year, 12, 1);
            const string vendorName = "Vendor name";

            const decimal expectedResult = BasePrice * LongLicenseMultiplicator;

            var license = new WishListItem(
                WishListItemType.ELearningLicense,
                BasePrice,
                vendorName,
                startDate: startDate,
                endDate: endDate);

            // When
            var result = license.CalculateCost();

            // Then
            Assert.That(result, Is.EqualTo(expectedResult));
        }