public void SetUp()
        {
            const int id = 4765;
            const string firstName = "Julie";
            const string lastName = "Li";
            var pet = new Pet {Id = 4987};
            var address = new Address("1234 Happy St", "Winnipeg", "MB", "R3B 2A2");

            _owner = new Owner
            {
                Id = id,
                FirstName = firstName,
                LastName = lastName,
                Address =address
            };

            _owner.AddPet(pet);

            var sameOwnerPlacedIntoSession = new Owner
            {
                Id = id,
                FirstName = firstName,
                LastName = lastName,
                Address = address
            };

            sameOwnerPlacedIntoSession.AddPet(pet);

            var sessionSource = FluentNHibernateMappingTester.GetNHibernateSessionWithWrappedEntity(sameOwnerPlacedIntoSession);
            _persistenceSpecification = new PersistenceSpecification<Owner>(sessionSource, new DomainEntityComparer());
        }
 public void Constructor_WithObjectInitializers_MatchProperties()
 {
     const string firstName = "Julie";
     const string lastName = "Smith";
     var sut = new Owner {FirstName = firstName, LastName = lastName};
     Assert.AreEqual(firstName, sut.FirstName);
     Assert.AreEqual(lastName, sut.LastName);
 }
 public void TwoInstances_SetSameId_AreEqual()
 {
     const int idValue = 3527;
     var sut1 = new Owner();
     var sut2 = new Owner();
     sut1.Id = idValue;
     sut2.Id = idValue;
     Assert.IsTrue(sut1.Equals(sut2));
 }
 public void AddressProperty_Set_ValidatesEquality()
 {
     const string firstName = "Julie";
     const string lastName = "Smith";
     var sut = new Owner { FirstName = firstName, LastName = lastName };
     var address = new Address("1234 Main St.", "Winnipeg", "MB", "R3B 2A2");
     sut.Address = address;
     Assert.IsTrue(sut.Address.Equals(address));
 }
        public void AddPetMethod_PetInput_IncrementsPetsAssociation()
        {
            const string firstName = "Julie";
            const string lastName = "Smith";
            var sut = new Owner { FirstName = firstName, LastName = lastName };

            var pet = new Pet();
            sut.AddPet(pet);

            Assert.AreEqual(1, sut.Pets.Count);
        }
 public void Constructor_NoInput_IsInstanceOfDomainEntity()
 {
     var sut = new Owner();
     Assert.IsInstanceOfType(typeof(DomainEntity), sut);
 }