当前位置: 首页>>代码示例>>C#>>正文


C# Solution.OrderMultiple方法代码示例

本文整理汇总了C#中Solution.OrderMultiple方法的典型用法代码示例。如果您正苦于以下问题:C# Solution.OrderMultiple方法的具体用法?C# Solution.OrderMultiple怎么用?C# Solution.OrderMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Solution的用法示例。


在下文中一共展示了Solution.OrderMultiple方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_order_with_too_big_package

        public void Test_order_with_too_big_package()
        {
            var sut = new Solution();

            var products = new Products {{"A", 1}};
            var price = 0;

            sut.Setup(products, new ProductPackages {new ProductPackage {Price = 6, Products = Enumerable.Repeat("A", 8).ToList()}});

            sut.SendPrice += p => price = p;

            sut.OrderMultiple(7, "A");

            price.Should().Be(7, "6 would be to many As");
        }
开发者ID:chrkon,项目名称:dotnetpro_Contests,代码行数:15,代码来源:Test.cs

示例2: Test_performance

        public void Test_performance()
        {
            var sut = new Solution();

            var products = new Products {{"A", 10}, {"B", 20}, {"C", 30}};
            var productPackages = new ProductPackages
            {
                new ProductPackage {Price = 29, Products = new List<string> {"A", "B"}},
                new ProductPackage {Price = 30, Products = new List<string> {"A", "A", "A", "A"}},
                new ProductPackage {Price = 48, Products = new List<string> {"B", "C"}},
                new ProductPackage {Price = 57, Products = new List<string> {"A", "B", "C"}}
            };

            sut.Setup(products, productPackages);
            sut.SendPrice += price => Console.WriteLine("{0,3}. Order, Price: {1,5}", count++, price);

            //sut.OrderMultiple(50, "A");
            //sut.OrderMultiple(5, "B");
            //sut.OrderMultiple(3, "C");
            sut.OrderMultiple(40, "A");
            sut.OrderMultiple(40, "B");
            sut.OrderMultiple(40, "C");
        }
开发者ID:chrkon,项目名称:dotnetpro_Contests,代码行数:23,代码来源:Test.cs

示例3: Test_order_where_it_is_not_better_to_take_highest_discount

        public void Test_order_where_it_is_not_better_to_take_highest_discount()
        {
            var sut = new Solution();

            var products = new Products { { "A", 10 } };
            var productPackages = new ProductPackages
            {
                new ProductPackage {Price = 47, Products = new List<string> {"A", "A", "A", "A", "A"}}, // discount 3/5 pp
                new ProductPackage {Price = 38, Products = new List<string> {"A", "A", "A", "A"}} // discount 1/2 pp
            };

            var price = 0;
            sut.Setup(products, productPackages);
            sut.SendPrice += p => price = p;

            sut.OrderMultiple(8, "A");

            price.Should().Be(2 * 38);
        }
开发者ID:chrkon,项目名称:dotnetpro_Contests,代码行数:19,代码来源:Test.cs


注:本文中的Solution.OrderMultiple方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。