Exemple #1
0
        public void CanCreateAttachedSharedContext()
        {
            // Arrange
            var settings = this.fixture.AppConfiguration.TerminologySqlSettings;

            // Act
            var factory = new SharedContextFactory(settings, this.fixture.Logger);
            var context = factory.Create(false);

            // Assert
            context.Should().NotBeNull();
            context.IsInMemory.Should().BeFalse();
        }
        private void Initialize()
        {
            var factory = new SharedContextFactory(this.AppConfiguration.TerminologySqlSettings, this.Logger);

            var clientTermFactory = this.ClientTermContextInMemory
                                        ? new ClientTermContextFactory(
                this.AppConfiguration.TerminologySqlSettings,
                this.Logger,
                new ClientTermSeededDatabaseInitializer())
                                        : new ClientTermContextFactory(
                this.AppConfiguration.TerminologySqlSettings,
                this.Logger);

            this.SharedContext     = factory.Create(this.SharedContextInMemory);
            this.ClientTermContext = clientTermFactory.Create(this.ClientTermContextInMemory);
            if (this.SharedContext.IsInMemory)
            {
                throw new InvalidOperationException("Cannot use in memory tests with the SharedContext");
            }
        }