コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();

            var items = new List <Item>()
            {
                new Ipad(), new MacBookPro(), new AppleTv(), new Vga()
            };

            AvailableItems.ItemsSource = items;

            var pricingRules = new PricingConfiguration().PricingRules;

            _checkOut = new Checkout.Core.Checkout(pricingRules);
        }
コード例 #2
0
ファイル: Tests.cs プロジェクト: neilhewitt/code-dojos
        public void CalculateSKUToPricing()
        {
            Pricing pricing = new Pricing();

            pricing.Add("A", 50, 3, 130);
            Assert.That(pricing.For("A"), Is.Not.Null);
            Assert.That(pricing.For("A").UnitPrice == 50);

            var checkout = new Checkout.Core.Checkout();

            var basket = new ShoppingBasket();

            var item = pricing.For("A");

            basket.Add(item);

            var total = checkout.Calculate(basket);
        }