Ejemplo n.º 1
0
        public void CanRetrySaveOfAnEntityWithValueObjectCollection()
        {
            //setup - trigger an exception inserting objects...

            User u = Om.CreateUser();

            u.AddOtherAddress("Business", Om.CreateInvalidUserAddress());
            Nh.CurrentSession.SaveOrUpdate(u);

            CommitSessionExpectingException();

            //run test

            //fix problem that was causing save to fail
            u.RemoveOtherAddress("Business");
            u.AddOtherAddress("Business", Om.CreateUserAddress("ME5 8HU"));

            //add another address value for good measure
            u.AddOtherAddress("Other", Om.CreateUserAddress("ME5 8HU"));

            ResetVersionPropertyTo(u, -1);
            PersistUsingNewSession(u);

            Assert.That(u.ConcurrencyId, Is.EqualTo(1), "user vs property ok");
        }