예제 #1
0
        public void Ctor_RegistersObject()
        {
            TestDomainBase.StaticCtorHandler +=
                (sender, args) =>
                Assert.That(ObjectInititalizationContextScope.CurrentObjectInitializationContext.RegisteredObject, Is.SameAs(sender));

            Order instance;

            try
            {
                instance = _transaction.ExecuteInScope(() => Order.NewObject());
            }
            finally
            {
                TestDomainBase.ClearStaticCtorHandlers();
            }

            Assert.That(_transaction.IsEnlisted(instance), Is.True);
            var dataContainer = _transaction.DataManager.DataContainers[instance.ID];

            Assert.That(dataContainer, Is.Not.Null);
            Assert.That(dataContainer.DomainObject, Is.SameAs(instance));
            Assert.That(dataContainer.ClientTransaction, Is.SameAs(_transaction));
        }
        public override void TearDown()
        {
            TestDomainBase.ClearStaticCtorHandlers();

            base.TearDown();
        }