Пример #1
0
        public static decimal GetCarValue(decimal purchaseValue, int months, int miles, int owners, int collisions)
        {
            Car car = new Car
            {
                AgeInMonths            = months,
                NumberOfCollisions     = collisions,
                NumberOfMiles          = miles,
                NumberOfPreviousOwners = owners,
                PurchaseValue          = purchaseValue
            };
            PriceDeterminator priceDeterminator = new PriceDeterminator();
            var carPrice = priceDeterminator.DetermineCarPrice(car);

            return(carPrice);
        }
        private static void AssertCarValue(decimal expectValue, decimal purchaseValue, int ageInMonths, int numberOfMiles, int numberOfPreviousOwners, int numberOfCollisions)
        {
            var car = new Car
            {
                AgeInMonths            = ageInMonths,
                NumberOfCollisions     = numberOfCollisions,
                NumberOfMiles          = numberOfMiles,
                NumberOfPreviousOwners = numberOfPreviousOwners,
                PurchaseValue          = purchaseValue
            };
            var     priceDeterminator = new PriceDeterminator();
            decimal carPrice          = priceDeterminator.DetermineCarPrice(car);

            Assert.AreEqual(expectValue, carPrice);
        }
Пример #3
0
        public void DetermineCarPrice_Always_Return_Expected_Value(decimal expectValue, decimal purchaseValue, int ageInMonths, int numberOfMiles, int numberOfPreviousOwners, int numberOfCollisions)
        {
            Car car = new Car
            {
                PurchaseValue          = purchaseValue,
                AgeInMonths            = ageInMonths,
                NumberOfMiles          = numberOfMiles,
                NumberOfPreviousOwners = numberOfPreviousOwners,
                NumberOfCollisions     = numberOfCollisions,
            };

            PriceDeterminator priceDeterminator = new PriceDeterminator();
            decimal           result            = priceDeterminator.DetermineCarPrice(car);

            Assert.AreEqual(expectValue, result);
        }
Пример #4
0
        private static void DisplayCarValue(decimal expectValue, decimal purchaseValue,
                                            int ageInMonths, int numberOfMiles, int numberOfPreviousOwners, int
                                            numberOfCollisions)
        {
            Car car = new Car
            {
                AgeInMonths            = ageInMonths,
                NumberOfCollisions     = numberOfCollisions,
                NumberOfMiles          = numberOfMiles,
                NumberOfPreviousOwners = numberOfPreviousOwners,
                PurchaseValue          = purchaseValue
            };
            PriceDeterminator priceDeterminator = new PriceDeterminator();
            var carPrice = priceDeterminator.DetermineCarPrice(car);

            Console.WriteLine("Expected Value: " + expectValue.ToString() + " Actual Value: " + carPrice.ToString());
        }