private static Person RemoveFromCollectionOnPersonOne(Person personToRemove) {
     Person person = GetPerson(1);
     Notifier.AllChangedObjects();
     person.ResetEvents();
     Persistor.StartTransaction();
     person.RemoveFromRelatives(personToRemove);
     Persistor.EndTransaction();
     return person;
 }
Пример #2
0
 public virtual void RemoveFromRelatives(Person person) {
     Relatives.Remove(person);
 }
Пример #3
0
 public virtual void AddToRelatives(Person person) {
     Relatives.Add(person);
 }
Пример #4
0
 public virtual string ValidateOwner(Person owner) {
     if (owner.Name == "Cruella") {
         return "Bad owner";
     }
     return null;
 }
 private static void AssertIsPerson(Person person, int id) {
     Assert.IsNotNull(person, "Failed to get instance");
     Assert.AreEqual(id, person.PersonId);
 }
 private static INakedObject GetAdaptedAddress(Person person) {
     INakedObject personAdapter = AdapterFor(person);
     return personAdapter.Specification.GetProperty("Address").GetNakedObject(personAdapter);
 }
 private static INakedObject GetAdaptedRelatives(Person person) {
     Persistor.StartTransaction();
     INakedObject personAdapter = AdapterFor(person);
     Persistor.EndTransaction();
     return personAdapter.Specification.GetProperty("Relatives").GetNakedObject(personAdapter);
 }
 private Pet NewPet(int id, string name, Person person) {
     var pet = Container.NewTransientInstance<Pet>();
     pet.PetId = id;
     pet.Name = name;
     pet.Owner = person;
     Container.Persist(ref pet);
     return pet;
 }
 private Person RemoveFromCollectionOnPersonOne(Person personToRemove) {
     var person = GetPerson(1);
     person.ResetEvents();
     TransactionManager.StartTransaction();
     person.RemoveFromRelatives(personToRemove);
     TransactionManager.EndTransaction();
     return person;
 }
 private Person AddToCollectionOnPersonOne(Person personToAdd) {
     var person = GetPerson(1);
     person.ResetEvents();
     TransactionManager.StartTransaction();
     person.AddToRelatives(personToAdd);
     TransactionManager.EndTransaction();
     return person;
 }
 private INakedObjectAdapter GetAdaptedRelatives(Person person) {
     TransactionManager.StartTransaction();
     var personAdapter = AdapterFor(person);
     TransactionManager.EndTransaction();
     return ((IObjectSpec) personAdapter.Spec).GetProperty("Relatives").GetNakedObject(personAdapter);
 }
 private INakedObjectAdapter GetAdaptedAddress(Person person) {
     var personAdapter = AdapterFor(person);
     return ((IObjectSpec) personAdapter.Spec).GetProperty("Address").GetNakedObject(personAdapter);
 }