public void CustomerShouldSetItselfAsAParentForItsOrders() { var customer = new Customer(); var order = new Order(); customer.AddOrder(order); Assert.AreSame(customer, order.Customer); }
public void CustomerShouldRememberIdentityWhenInitializedFromDatabase() { var customer = new Customer(); var guid = Guid.NewGuid(); customer.Id = guid; Assert.AreEqual(guid, customer.Id); }
public void CustomerShouldAddOrderToOrders() { var customer = new Customer(); var order = new Order(); customer.AddOrder(order); CollectionAssert.Contains(customer.Orders, order); }
public void Be_Able_To_Delete_Entity() { var oldValue = SetHelperFactory(_mockFactory.Object); var repo = new Repository(); var cust = new Customer {Int32Id = 4}; repo.Delete(cust); _mockSession.Verify(ms => ms.Delete(cust)); SetHelperFactory(oldValue); repo.Dispose(); }
public void Can_Save_New_Customer() { var customer = new Customer { ContactName = "johnny", Email = "*****@*****.**" }; using (var repo = new RepositoryFactory().Create()) { repo.Add(customer); repo.Save(); } using (var repo = new RepositoryFactory().Create()) { var cust = repo.All<Customer>().SingleOrDefault(c => c.Email == "*****@*****.**"); Assert.IsNotNull(cust); } }
private Customer GetCustomer() { var customer = new Customer { ContactName = "johnny", Email = "*****@*****.**", Country = "Italy" }; var order1 = new Order { ShipName = "fjh rty", ShipAddress = "374 drgiaeroiu", ShipCity = "rtuket", ShipRegion = "reag qae", ShipPostalCode = "34573", ShipCountry = "tyjtwere" }; var order2 = new Order { ShipName = "ghdgh", ShipAddress = "fjsr4 4545 fghsf", ShipCity = "fyjshrk", ShipRegion = "tdguyket", ShipPostalCode = "9345672", ShipCountry = "ryjsytr" }; var detail = new OrderDetail { UnitPrice = 90.4m, Quantity = 28, Discount = 67.66m }; order1.AddOrderDetail(detail); customer.AddOrder(order1); customer.AddOrder(order2); return customer; }
public void CustomerShouldCreateIdentityWhenNotInitializedFromDatabase() { var customer = new Customer(); Assert.AreNotEqual(Guid.Empty, customer.Id); }