Guest User

Untitled

a guest
Jul 12th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. [Test]
  2. public void shouldCorrectlyOrder()
  3. {
  4. {
  5. var product1 = new Product { Name = "Apples", UnitPrice = 4.5m, Discontinued = true };
  6. var product2 = new Product { Name = "Pears", UnitPrice = 3.5m, Discontinued = false };
  7.  
  8. Session.Save(product1);
  9. Session.Save(product2);
  10.  
  11. var orderItems = new List<OrderItem>
  12. {
  13. new OrderItem {Id = 1, Quantity = 100, Product = product1},
  14. new OrderItem {Id = 2, Quantity = 200, Product = product2},
  15. };
  16.  
  17. var customer = new Customer
  18. {
  19. FirstName = "John",
  20. LastName = "Doe",
  21. AddressLine1 = "1st Street",
  22. PostalCode = "78279",
  23. City = "Austin",
  24. CountryCode = "US"
  25. };
  26. var employee = new Employee { FirstName = "Sue", LastName = "Wong" };
  27.  
  28. new PersistenceSpecification<Order>(Session)
  29. .CheckProperty(o => o.OrderDate, DateTime.Today)
  30. .CheckReference(o => o.Customer, customer)
  31. .CheckReference(o => o.Employee, employee)
  32. .CheckList(o => o.OrderItems, orderItems)
  33. .VerifyTheMappings();
  34. }
  35. }
  36.  
  37. [Test]
  38. public void shouldCorrectlyProduct()
  39. {
  40. new PersistenceSpecification<Product>(Session)
  41. .CheckProperty(p => p.Name, "Apples")
  42. .CheckProperty(p => p.UnitPrice, 10.45m)
  43. .CheckProperty(p => p.Discontinued, true)
  44. .VerifyTheMappings();
  45. }
Add Comment
Please, Sign In to add comment