public void InsertConcreteSingle() { TICustomer expectedCustomer = TICustomer.NewObject(); expectedCustomer.FirstName = "Franz"; expectedCustomer.LastName = "Kameramann"; expectedCustomer.DateOfBirth = new DateTime(1950, 1, 3); expectedCustomer.CustomerType = CustomerType.Premium; expectedCustomer.CustomerSince = DateTime.Now; TIAddress expectedAddress = TIAddress.NewObject(); expectedAddress.Street = "Linzer Straße 1"; expectedAddress.Zip = "3100"; expectedAddress.City = "St. Pölten"; expectedAddress.Country = "Österreich"; expectedAddress.Person = expectedCustomer; ClientTransactionScope.CurrentTransaction.Commit(); using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope()) { TICustomer actualCustomer = expectedCustomer.ID.GetObject <TICustomer> (); Assert.That(actualCustomer, Is.Not.Null); Assert.That(actualCustomer.Address.ID, Is.EqualTo(expectedAddress.ID)); } }
public void RelationsFromConcreteSingle() { TICustomer customer = DomainObjectIDs.Customer.GetObject <TICustomer> (); Assert.That(customer.CreatedBy, Is.EqualTo("UnitTests")); Assert.That(customer.FirstName, Is.EqualTo("Zaphod")); Assert.That(customer.CustomerType, Is.EqualTo(CustomerType.Premium)); TIRegion region = customer.Region; Assert.That(region, Is.Not.Null); Assert.That(region.ID, Is.EqualTo(DomainObjectIDs.Region)); DomainObjectCollection orders = customer.Orders; Assert.That(orders.Count, Is.EqualTo(1)); Assert.That(orders[0].ID, Is.EqualTo(DomainObjectIDs.Order)); DomainObjectCollection historyEntries = customer.HistoryEntries; Assert.That(historyEntries.Count, Is.EqualTo(2)); Assert.That(historyEntries[0].ID, Is.EqualTo(DomainObjectIDs.HistoryEntry2)); Assert.That(historyEntries[1].ID, Is.EqualTo(DomainObjectIDs.HistoryEntry1)); TIClient client = customer.Client; Assert.That(client.ID, Is.EqualTo(DomainObjectIDs.Client)); Assert.That(customer.AbstractClassesWithoutDerivations, Is.Empty); }
public void UpdateConcreteSingle() { TIRegion expectedNewRegion = TIRegion.NewObject(); expectedNewRegion.Name = "Wachau"; TICustomer expectedCustomer = DomainObjectIDs.Customer.GetObject <TICustomer> (); expectedCustomer.LastName = "NewLastName"; expectedCustomer.Region = expectedNewRegion; ClientTransactionScope.CurrentTransaction.Commit(); using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope()) { TICustomer actualCustomer = expectedCustomer.ID.GetObject <TICustomer> (); Assert.That(actualCustomer.LastName, Is.EqualTo("NewLastName")); Assert.That(actualCustomer.Region.ID, Is.EqualTo(expectedNewRegion.ID)); } }