public PlaceOrder ( |
||
product | Product to order. | |
quantity | int | Quantity of the product to order. |
deliverBy | DateTimeOffset | Requested delivery date. |
instructions | string | Delivery instructions. |
Результат | Acme.Common.OperationResult |
public void PlaceOrderTest_NullProduct_Exception() { // Arrange var vender = new Vendor(); // Act var actual = vender.PlaceOrder(null, 12); // Assert }
public void PlaceOrder_NullProduct_Exception() { // Arrange var vendor = new Vendor(); // Act var actual = vendor.PlaceOrder(null, 12); // Assert // Expected exception }
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); }
public void PlaceOrderTest() { // Arrange var vendor = new Vendor(); var product = new Product(1, "Saw", ""); var expected = new OperationResult(true, "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + "\r\nInstructions: standard delivery"); // Act var actual = vendor.PlaceOrder(product, 12); // Assert Assert.AreEqual(expected.Success, actual.Success); Assert.AreEqual(expected.Message, actual.Message); }
public void PlaceOrderTest() { // Arrange var vendor = new Vendor(); var product = new Product(); var expected = new OperationResult(true, "Order from Acme, Inc\r\nProduct: Tools-1\r\nQuantity: 12"); // Act var actual = vendor.PlaceOrder(product, 12); Console.WriteLine(expected.Message); Console.WriteLine(actual.Message); // Assert Assert.AreEqual(expected.Success, actual.Success); Assert.AreEqual(expected.Message, actual.Message); }
public void PlaceOrder_NoDeliveryDate() { // Arrange var vendor = new Vendor(); var product = new Product(1, "Saw", ""); var expected = new OperationResult<bool,string>(true, "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + "\r\nInstructions: Deliver to Suite 42"); // Act var actual = vendor.PlaceOrder(product, 12, instructions: "Deliver to Suite 42"); // Assert Assert.AreEqual(expected.Result, actual.Result); Assert.AreEqual(expected.Message, actual.Message); }
public void PlaceOrder_3Parameters() { // Arrange var vendor = new Vendor(); var product = new Product(1, "Saw", ""); var expected = new OperationResult(true, "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + "\r\nDeliver By: " + new DateTime(2018,10,25).ToString("d") + "\r\nInstructions: standard delivery"); // Act var actual = vendor.PlaceOrder(product, 12, new DateTimeOffset(2018, 10, 25, 0, 0, 0, new TimeSpan(-7, 0, 0))); // Assert Assert.AreEqual(expected.Success, actual.Success); Assert.AreEqual(expected.Message, actual.Message); }
public void PlaceOrderTest_WithAddress() { // Arrange var vendor = new Vendor(); var product = new Product(1, "Saw", ""); var expected = new OperationResult(true, "Test With Address"); // Act var actual = vendor.PlaceOrder(product, 12, Vendor.IncludeAddress.Yes, Vendor.SendCopy.No); // Assert Assert.AreEqual(expected.Success, actual.Success); Assert.AreEqual(expected.Message, actual.Message); }
public void PlaceOrderTest_ImproperQuantity_Exception() { // Arrange var vender = new Vendor(); // Act var actual = vender.PlaceOrder(new Product(1, "Hammer", ""), 0); // Assert }
public void PlaceOrder_3Parameters() { // 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" + "\nInstructions: standard delivery"); // Act var actual = vender.PlaceOrder(product, 1, instructions: "standard delivery"); // Assert Assert.AreEqual(expected.Success, actual.Success); Assert.AreEqual(expected.Message, actual.Message); }
public void PlaceOrder_NegativeQuantity_ExceptionTest() { // Arrange var vendor = new Vendor(); var product = new Product(1, "Saw", ""); // Act var actual = vendor.PlaceOrder(product, -1); // Assert // Arguement Out of range rxception is expected }
public void PlaceOrder_NullProduct_ExceptionTest() { // Arrange var vendor = new Vendor(); // Act var actual = vendor.PlaceOrder(null, 1); // Assert // Arguement Null Exception is expected }
public void PlaceOrder_3Parameters() { // Arrange var vendor = new Vendor(); var product = new Product(1, "Saw", ""); var expected = new OperationResult(true, "Order from Acme, Inc\r\nProduct: Tools-1\r\nQuantity: 12" + "\r\nDeliver By: 2/15/2016"); // Act var actual = vendor.PlaceOrder(product, 12, new DateTimeOffset(2016, 02, 15, 0, 0, 0, new TimeSpan(5, 30, 0))); // Assert Assert.AreEqual(expected.Success, actual.Success); Assert.AreEqual(expected.Message, actual.Message); }