public bool Save(Vendor vendor) { var success = true; // Code that saves the vendor return success; }
private void LoadData() { vendorRepository = new VendorRepository(); currentVendor = vendorRepository.Retrieve(1); // Populate the form this.CompanyNameTextBox.Text = currentVendor.CompanyName; this.EmailTextBox.Text = currentVendor.Email; }
public void PlaceOrderTest_NullProduct_Exception() { // Arrange var vender = new Vendor(); // Act var actual = vender.PlaceOrder(null, 12); // Assert }
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_NullProduct_Exception() { // Arrange var vendor = new Vendor(); // Act var actual = vendor.PlaceOrder(null, 12); // Assert // Expected exception }
public void SendWelcomeEmail_NullCompany_Success() { // Arrange var vendor = new Vendor(); vendor.CompanyName = null; var expected = "Message sent: Hello"; // Act var actual = vendor.SendWelcomeEmail("Test Message"); // Assert Assert.AreEqual(expected, actual); }
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); }
/// <summary> /// Retrieve one vendor. /// </summary> public Vendor Retrieve(int vendorId) { // Create the instance of the Vendor class Vendor vendor = new Vendor(); // Code that retrieves the defined customer // Temporary hard coded values to return if (vendorId == 1) { vendor.VendorId = 1; vendor.CompanyName = "ABC Corp"; vendor.Email = "*****@*****.**"; } return vendor; }
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: Tools-1\r\nQuantity: 12" + "\r\nDeliver By: 10/25/2015"); // Act var actual = vendor.PlaceOrder(product, 12, new DateTimeOffset(2015, 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() { // 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_3Parameters() { // Arrange var vendor = new Vendor(); var product = new Product(1, "Saw", ""); var expected = new OperationResult<bool>(true, "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + "\r\nDeliver By: 10/25/2018" + "\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.Result, actual.Result); 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_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 bool FilterCompanies(Vendor v) => v.CompanyName.Contains("Toy");
public string SayHello() { var vendor = new Vendor(); vendor.SendWelcomeEmail("Message from Product"); var emailService = new EmailService(); emailService.SendMessage("New Product", this.ProductName, "*****@*****.**"); var result = LogAction("Product SayHello"); return "Hello " + ProductName + " (" + ProductId + "): " + Description + " Available on: " + AvailabilityDate?.ToShortDateString(); }
public void ToStringTest() { // Arrange var vendor = new Vendor(); vendor.VendorId = 1; vendor.CompanyName = "ABC Corp"; var expected = "Vendor: ABC Corp (1)"; // Act var actual = vendor.ToString(); // Assert Assert.AreEqual(expected, actual); }
public void PrepareDirectionsTest() { // Arrange var vendor = new Vendor(); var expected = @"Insert \r\n to define a new line"; // Act var actual = vendor.PrepareDirections(); Console.WriteLine(actual); // Assert Assert.AreEqual(expected, actual); }
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 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 LoadData() { currentVendor = vendorRepository.Retrieve(1); }