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


C# Biz.Product类代码示例

本文整理汇总了C#中Acme.Biz.Product的典型用法代码示例。如果您正苦于以下问题:C# Product类的具体用法?C# Product怎么用?C# Product使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Product类属于Acme.Biz命名空间,在下文中一共展示了Product类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlaceOrder

        /// <summary>
        /// Sends a product order to the vendor.
        /// </summary>
        /// <param name="product">Product to order.</param>
        /// <param name="quantity">Quantity of the product to order.</param>
        /// <returns></returns>
        public OperationResult PlaceOrder(Product product, int quantity)
        {
            //// Guard clauses make sure passed in values are within constraints.
            //if (product == null) throw new ArgumentNullException(nameof(product));
            //if (quantity <= 0) throw new ArgumentOutOfRangeException(nameof(product));

            //var success = false;

            //var orderText = "Order from ACME, Inc" + "\n" +
            //                "Product: " + product.ProductCode + "\n" +
            //                "Quantity: " + quantity;

            //var emailService = new EmailService();
            //var confirmation = emailService.SendMessage("New Order", orderText, Email);

            //if (confirmation.StartsWith("Message sent: "))
            //{
            //    success = true;
            //}

            //var operationResult = new OperationResult(success, orderText);
            //return operationResult;

            //// Example of method chaining
            return PlaceOrder(product, quantity, null, null);
        }
开发者ID:jimxshaw,项目名称:samples-csharp,代码行数:32,代码来源:Vendor.cs

示例2: PlaceOrder

        /// <summary>
        /// Sends a product order to the vendor.
        /// </summary>
        /// <param name="product">Product to order.</param>
        /// <param name="quantity">Quantity of the product to order.</param>
        /// <param name="includeAddress">True to include the shipping address in the order.</param>
        /// <param name="sendCopy">True to send a copy of the email to the current user.</param>
        /// <returns>Success flag and order text</returns>
        public OperationResult PlaceOrder(Product product, int quantity,
                                          IncludeAddress includeAddress, 
                                          SendCopy sendCopy)
        {
            var orderText = "Test";
            if (includeAddress == IncludeAddress.Yes) orderText += " With Address";
            if (sendCopy == SendCopy.Yes) orderText += " With Copy";

            var operationResult = new OperationResult(true, orderText);
            return operationResult;
        }
开发者ID:dldzone,项目名称:charpBestPractices,代码行数:19,代码来源:Vendor.cs

示例3: MinimumPriceTest_Default

        public void MinimumPriceTest_Default()
        {
            //Arrage
            var currentProduct = new Product();
            var expectedMessage = 0.96m;

            //Act
            var actual = currentProduct.MinimumPrice;

            //Assert
            Assert.AreEqual(expectedMessage, actual);
        }
开发者ID:manojkulkarni30,项目名称:CSharpBP-Basics,代码行数:12,代码来源:ProductTests.cs

示例4: MinimumPriceTest_Bulk

        public void MinimumPriceTest_Bulk()
        {
            //Arrange
            var currentProduct = new Product(1, "Bulk Tools", "");
            var expected = 9.99m;

            //Act
            var actual = currentProduct.MinimumPrice;

            //Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:Robooto,项目名称:AcmeApp,代码行数:12,代码来源:ProductTests.cs

示例5: SayHello_ParameterizedConstructor_Test

        public void SayHello_ParameterizedConstructor_Test()
        {
            //Arrange
            var currentProduct = new Product("Honda", 2346, "Nice car from Japan");
            var expected = "Hello Honda (2346): Nice car from Japan" + " Available on: ";

            //Act
            var actual = currentProduct.SayHello();

            //Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:ethanchang1984,项目名称:CSharpBP-Basics,代码行数:12,代码来源:ProductTests.cs

示例6: SayHello_ParameterizedConstructor

        public void SayHello_ParameterizedConstructor()
        {
            //Arrange
            var currentProduct = new Product(1, "Saw",
                                "15-inch steel blade hand saw");
            var expected = "Hello Saw (1): 15-inch steel blade hand saw";

            //Act
            var actual = currentProduct.SayHello();

            //Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:dldzone,项目名称:charpBestPractices,代码行数:13,代码来源:ProductTests.cs

示例7: ProductName_Format

        public void ProductName_Format()
        {
            //Arrange
            var currentProduct = new Product();
            currentProduct.ProductName = "  Steel Hammer   ";

            var expected = "Steel Hammer";
            //Act
            var actual = currentProduct.ProductName;

            //Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:Robooto,项目名称:AcmeApp,代码行数:13,代码来源:ProductTests.cs

示例8: CalculateSuggestedPriceTest

        public void CalculateSuggestedPriceTest()
        {
            // Arrange
            var currentProduct = new Product(1, "Saw", "");
            currentProduct.Cost = 50m;
            var expected = 55m;

            // Act
            var actual = currentProduct.CalculateSuggestedPrice(10m);

            // Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:ToMissTheMarc,项目名称:CSharpBP-Collections,代码行数:13,代码来源:ProductTests.cs

示例9: CalculateSuggestedPriceTest

        public void CalculateSuggestedPriceTest()
        {
            // Arrange
            var currentProduct = new Product(1, "Saw", "");
            currentProduct.Cost = 50m;
            var expected = new OperationResult<decimal>(55m, "");

            // Act
            var actual = currentProduct.CalculateSuggestedPrice(10m);

            // Assert
            Assert.AreEqual(expected.Result, actual.Result);
            Assert.AreEqual(expected.Message, actual.Message);
        }
开发者ID:jimxshaw,项目名称:samples-csharp,代码行数:14,代码来源:ProductTests.cs

示例10: SayHello_ParamterizedConstructor

        public void SayHello_ParamterizedConstructor()
        {
            //Arrange
            var currentProduct = new Product(1, "Hammer", "A sturdy tool");

            var expected = "Hello Hammer (1): A sturdy tool" +
                           " Available on: ";

            //Act
            var actual = currentProduct.SayHello();

            //Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:jimxshaw,项目名称:samples-csharp,代码行数:14,代码来源:ProductTests.cs

示例11: SayHelloTest

        public void SayHelloTest()
        {
            //Arrange
            var currentProduct = new Product();
            currentProduct.ProductName = "Saw";
            currentProduct.ProductId = 1;
            currentProduct.Description = "15-inch steel blade hand saw";
            var expected = "Hello Saw (1): 15-inch steel blade hand saw";

            //Act
            var actual = currentProduct.SayHello();

            //Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:dldzone,项目名称:charpBestPractices,代码行数:15,代码来源:ProductTests.cs

示例12: PlaceOrderTest

        public void PlaceOrderTest()
        {
            // Arrange
            var vender = new Vendor();
            var product = new Product(1, "Hammer", "");
            var expected = new OperationResult(true,
                                "Order from ACME, Inc\nProduct: Tools-1\nQuantity: 1");

            // Act
            var actual = vender.PlaceOrder(product, 1);

            // Assert
            Assert.AreEqual(expected.Success, actual.Success);
            Assert.AreEqual(expected.Message, actual.Message);
        }
开发者ID:jimxshaw,项目名称:samples-csharp,代码行数:15,代码来源:VendorTests.cs

示例13: SayHelloTest

        public void SayHelloTest()
        {
            //Arrange
            var currentProduct = new Product();
            currentProduct.ProductName = "Honda";
            currentProduct.ProductId = 2346;
            currentProduct.Description = "Nice car from Japan";
            currentProduct.ProductVendor.CompanyName = "Honda Ltd.";
            var expected = "Hello Honda (2346): Nice car from Japan" + " Available on: ";

            //Act
            var actual = currentProduct.SayHello();

            //Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:ethanchang1984,项目名称:CSharpBP-Basics,代码行数:16,代码来源:ProductTests.cs

示例14: SayHello_ParameterizedConstructorTest

        public void SayHello_ParameterizedConstructorTest()
        {
            //Arrage
            var currentProduct = new Product(1,"Saw", "Steel Blade hand saw");
            //currentProduct.ProductId = 1;
            //currentProduct.ProductName = "Saw";
            //currentProduct.Description = "Steel Blade hand saw";
            var expectedMessage = "Hello Saw (1) Steel Blade hand saw";

            //Act
            Console.WriteLine("Current Product" + currentProduct.ProductName);
            var actual = currentProduct.SayHello();

            //Assert
            Assert.AreEqual(expectedMessage, actual);
        }
开发者ID:manojkulkarni30,项目名称:CSharpBP-Basics,代码行数:16,代码来源:ProductTests.cs

示例15: SayHelloParmTest

        public void SayHelloParmTest()

        {
            //arrange
            var currentProduct = new Product(1, "Saw", "15-inch steel blade hand saw");

            var expected = "Hello Saw (1) 15-inch steel blade hand saw" +
               " Available on: ";

            //act
            var actual = currentProduct.SayHello();

      
            //assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:dldzone,项目名称:charpBestPractices,代码行数:16,代码来源:ProductTests.cs


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