public void WriteToFileTest() { //--Arrange var changedItems = new List<ILoggable>(); var customer = new Customer(1) { EmailAddress = "*****@*****.**", FirstName = "Frodo", LastName = "Baggins", AddressList = null }; changedItems.Add(customer as ILoggable); var product = new Product(2) { ProductName = "Rake", ProductDescription = "Garden Rake with Steel handle", CurrentPrice = 6M }; changedItems.Add(product as ILoggable); //--Act LoggingService.WriteToFile(changedItems); //--Assert //Nothing to assert }
public void WriteToFileTest() { // Arrange var changedItems = new List<ILoggable>(); var customer = new Customer(1) { FirstName = "John", LastName = "Lennon", EmailAddress = "*****@*****.**", AddressList = null }; var product = new Product() { ProductName = "Guitar", CurrentPrice = 399.99M, ProductDescription = "Gibson Les Paul" }; changedItems.Add(customer as ILoggable); changedItems.Add(product as ILoggable); // Act LoggingService.WriteToFile(changedItems); // Assert // Nothing to assert in this case. }
public void ProductRepositoryRetrieveTest() { //Blindly testing around Product product = new Product(7); Object myObject = new Object(); Console.WriteLine("Peep " + myObject.ToString()); Console.WriteLine("Bloop " + product.ToString()); var productRepository = new ProductRepository(); Console.WriteLine("Nerp " + productRepository); var actual = productRepository.Retrieve(7); }
public bool Save(Product product) { var success = true; if (product.HasChanges && product.IsValid) { if (product.IsNew) { //Call an insert stored procedure } else { //Call an Update Stored Procedure } } return success; }
/// <summary> /// Retrieve one product. /// </summary> public Product Retrieve(int productId) { // Create the instance of the Product class // Pass in the requested Id Product product = new Product(productId); // Code that retrieves the defined product // Temporary hard coded values to return // a populated product if (productId == 2) { product.ProductName = "Sunflowers"; product.ProductDescription = "Assorted Size Set of 4 Bright Yellow Mini Sunflowers"; product.CurrentPrice = 15.96M; } return product; }
public void RetrieveTest() { //-- Arrange var productRepository = new ProductRepository(); var expected = new Product(2) { CurrentPrice = 15.96M, ProductDescription = "Assorted Size Set of 4 Bright Yellow Mini Sunflowers", ProductName = "Sunflowers" }; //-- Act var actual = productRepository.Retrieve(2); //-- Assert Assert.AreEqual(expected.CurrentPrice, actual.CurrentPrice); Assert.AreEqual(expected.ProductDescription, actual.ProductDescription); Assert.AreEqual(expected.ProductName, actual.ProductName); }
// Retrieve one product public Product Retrieve(int productId) { // Create the instance of the product class // Pass in the requested Id Product product = new Product(productId); Object myObject = new Object(); if (productId == 7) { Console.WriteLine("Objectwww: " + myObject.ToString()); Console.WriteLine("Productwww: " + product.ToString()); } // Temporary hard codded values to return // a populated product if (productId == 2) { product.ProductName = "Sunflowers"; product.ProductDescription = "Assorted Size"; product.CurrentPrice = 15.96M; } return product; }
/// <summary> /// Saves the current product. /// </summary> /// <returns></returns> public bool Save(Product product) { // Code that saves the defined product return true; }