public void Create_Throws_InvalidOperationException_When_No_DataContextProvider_Has_Been_Set()
 {
     var factory = new EFUnitOfWorkFactory();
     Assert.Throws<InvalidOperationException>(
         () => factory.Create()
         );
 }
Esempio n. 2
0
        public void Create_Throws_InvalidOperationException_When_No_DataContextProvider_Has_Been_Set()
        {
            var factory = new EFUnitOfWorkFactory();

            Assert.Throws <InvalidOperationException>(
                () => factory.Create()
                );
        }
        public void Create_Returns_NHUnitOfWork_Instance_When_SessionFactoryProvider_Has_Been_Set()
        {
            var factory = new EFUnitOfWorkFactory();
            factory.RegisterContextProvider(() => new OrderEntities());
            var uowInstance = factory.Create();

            Assert.That(uowInstance, Is.Not.Null);
            Assert.That(uowInstance, Is.TypeOf(typeof(EFUnitOfWork)));
        }
        public void Create_Returns_NHUnitOfWork_Instance_When_SessionFactoryProvider_Has_Been_Set()
        {
            var factory = new EFUnitOfWorkFactory();

            factory.RegisterContextProvider(() => new OrderEntities());
            var uowInstance = factory.Create();

            Assert.That(uowInstance, Is.Not.Null);
            Assert.That(uowInstance, Is.TypeOf(typeof(EFUnitOfWork)));
        }
        public void Create_Returns_LinqToSqlUnitOfWork_Instance_When_DataContextProvider_Has_Been_Set()
        {
            EFUnitOfWorkFactory.SetObjectContextProvider(() => new TestModel());

            var factory = new EFUnitOfWorkFactory();
            var uowInstance = factory.Create();

            Assert.That(uowInstance, Is.Not.Null);
            Assert.That(uowInstance, Is.TypeOf(typeof(EFUnitOfWork)));

            EFUnitOfWorkFactory.SetObjectContextProvider(null);
        }
Esempio n. 6
0
        public void Create_Returns_LinqToSqlUnitOfWork_Instance_When_DataContextProvider_Has_Been_Set()
        {
            EFUnitOfWorkFactory.SetObjectContextProvider(() => new TestModel());

            var factory     = new EFUnitOfWorkFactory();
            var uowInstance = factory.Create();

            Assert.That(uowInstance, Is.Not.Null);
            Assert.That(uowInstance, Is.TypeOf(typeof(EFUnitOfWork)));

            EFUnitOfWorkFactory.SetObjectContextProvider(null);
        }