public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); //obtiuene de la base return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); var addressRepository = new AddressRepository(); if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, 04, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = addressRepository.Retrieve(1); } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sun Flowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public void RetrieveOrderDisplayTest() { //--Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Bilbo", LastName = "Baggins", OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot End", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }, orderDisplayItemList = new List<OrderDisplayItem>() { new OrderDisplayItem () { OrderQuantity = 2, ProductName = "Sunflowers", PurchasePrice = 15.96M, }, new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 } } }; //--Act var actual = orderRepository.RetrieveOrderDisplay(10); //--Assert Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice); } }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); orderDisplay.orderDisplayItemList = new List <OrderDisplayItem>(); return(orderDisplay); }
/// <summary> /// Retrieve one order /// </summary> /// <param name="orderId"></param> /// <returns></returns> public OrderDisplay RetrieveOrderDisplay(int orderId) { //create the instance of the Order class //pass in the order id OrderDisplay orderDisplay = new OrderDisplay(); //code that retrieves the defined order fields //temporary hard coded values to return //a populated order if (orderId == 10) { orderDisplay.FirstName = "Glenn"; orderDisplay.LastName = "Danzig"; orderDisplay.OrderDate = new DateTimeOffset(2018, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Kitten Town", StreetLine2 = "Kitten Circle", City = "Hoboken", State = "New Jersey", Country = "United States", PostalCode = "666" }; } orderDisplay.orderDisplayItemList = new List <OrderDisplayItem>(); //code that retrieves order item //temporary hard coded items if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sure Step Kitty Litter", PurchasePrice = 16.99M, OrderQuantity = 2 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Litter Box Scooper", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); //Code that retrieves the define fields //Temp hardcoded values if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot End", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }; } orderDisplay.orderDisplayItemList = new List<OrderDisplayItem>(); //Code that retrieves order items //Temp hardcoded data if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); } return orderDisplay; }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); //code that retrieves the defined order fields // Temporary Hard-coded data if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2018, 09, 02, 23, 52, 00, new TimeSpan(-6, 0, 0)); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }; } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); //code that retrieves the order items //temporary hard-coded data if (orderId == 10) { orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }, new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 } }; } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); //Code that retrieves the define fields //Temp hardcoded values if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot End", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }; } orderDisplay.orderDisplayItemList = new List <OrderDisplayItem>(); //Code that retrieves order items //Temp hardcoded data if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderID) { OrderDisplay orderDisplay = new OrderDisplay(); // temp hardcoded if (orderID == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, TimeSpan.Zero); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }; } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); if (orderID == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.95M, OrderItemQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderItemQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); //Temporary hard coded if (orderId == 10) { orderDisplay.FirstName = "Duc"; orderDisplay.LastName = "Mai"; orderDisplay.OrderDate = new DateTimeOffset(2019, 2, 28, 23, 0, 0, TimeSpan.FromHours(+3)); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot row", City = "Quincy", State = "MA", Country = "United States", PostalCode = "02169" }; } orderDisplay.orderDisplayItemList = new List <OrderDisplayItem>(); //Temporary hard coded if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.9M, OrderQuantity = 2 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int OrderId) { var orderDisplay = new OrderDisplay(); if (OrderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2018, 10, 10, 00, 00, 00, new TimeSpan()); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bad End", StreetLine2 = "Bagshot row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }; orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); if (OrderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); // Code that retrieves the defined order fields var addressRepository = new AddressRepository(); // Temporary Hard-coded data if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = addressRepository.Retrieve(1); } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); // Code that retrieves the order items // Temporary Hard-coded data if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); // Code that retrieves the defined order fields var addressRepository = new AddressRepository(); // Temporary Hard-coded data if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = addressRepository.Retrieve(1); } orderDisplay.OrderDisplayItemList = new List<OrderDisplayItem>(); // Code that retrieves the order items // Temporary Hard-coded data if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return orderDisplay; }
/// <summary> /// Doesn't check for OrderDisplayItemList /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } if (this.GetType() != obj.GetType()) { return(false); } OrderDisplay rhs = obj as OrderDisplay; return(this.FirstName == rhs.FirstName && this.LastName == rhs.LastName && Nullable.Compare <DateTimeOffset>(this.OrderDate, rhs.OrderDate) == 0 && this.OrderID == rhs.OrderID && this.ShippingAddress.Equals(rhs.ShippingAddress)); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); if (orderId == 10) { orderDisplay.FirstName = "panchal"; orderDisplay.LastName = "parth"; var time = DateTime.Now; orderDisplay.OrderDate = new DateTimeOffset(time); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "StreetLine2", City = "gdh", State = "Gujrat", Country = "India", PostalCode = "384001" }; } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "toy", PurchasePrice = 50, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "toy", PurchasePrice = 50, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); if (orderId == 10) { orderDisplay.FirstName = "Zelimir"; orderDisplay.LastName = "Ilic"; orderDisplay.OrderDate = new DateTimeOffset(2018, 2, 14, 10, 00, 00, new TimeSpan(1, 0, 0)); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Majke Jevrosime bb", StreetLine2 = "selo Zuce", City = "Beograd", State = "Srbija", PostalCode = "11000", Country = "Srbija" }; } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Tulips", PurchasePrice = 12.54M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Raketa", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); if (orderId == 10) { orderDisplay.FirstName = "Zebby"; orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "27 Lakeside Dr" }; } orderDisplay.orderDisplayItemList = new List <OrderDisplayItem>(); if (orderId == 10) { OrderDisplayItem orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", OrderQuantity = 5 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Cakes", OrderQuantity = 6 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public void RetrieveOrderDisplayTest() { // Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Bilbo", LastName = "Baggins", OrderDate = new DateTimeOffset(2015, 7, 29, 10, 00, 00, new TimeSpan()), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot Row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }, orderDisplayItemList = new List<OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }, new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 } } }; // Actual // *Had fun with this one. Good bug hunting experience. // OrderRepository above was set as = new OrderDisplay(); // *Below was unable to locate the reference orderRepository.??? // *Now corrected to be var orderRepository = new OrderRepository(); // #RememberingTheGoodTimes! var actual = orderRepository.RetrieveOrderDisplay(10); // Assertion Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice); } }