Esempio n. 1
0
        public Reflector(Dictionary <char, char> connections, ReflectorType type, IEventAggregator eventAggregator, IUtilityFactory utilityFactory)
        {
            _connections    = connections;
            _utilityFactory = utilityFactory;

            Type = type;
            ReflectorAggregator = eventAggregator;
        }
        public void Members_DifferentArguments_HaveExpectedProps()
        {
            // Arrange
            IUtilityFactory utilityFactory = SQLiteUtilityFactory.Instance;

            // get SQLite stuff loaded.
            using (new SQLiteConnection())
            {
            }

            // Act
            var dbProviderName = utilityFactory.DbProviderName;

            IDbConnection connection       = utilityFactory.CreateConnection();
            var           tuple            = DbUtils.CreateSQLiteConnectionString();
            var           filePath         = tuple.Item1;
            var           connectionString = tuple.Item2;

            connection.ConnectionString = connectionString;
            connection.Open();

            IDialect dialect = utilityFactory.GetDialect();

            IScriptBuilder scriptBuilder = utilityFactory.CreateScriptBuilder();

            IDbInspector dbInspector = utilityFactory.CreateDbInspector(connection);

            ITableInspector tableInspector = utilityFactory.CreateTableInspector(connection, "language");

            ICruder cruder = utilityFactory.CreateCruder(connection);

            IDbSerializer dbSerializer = utilityFactory.CreateDbSerializer(connection);

            // Assert
            Assert.That(dbProviderName, Is.EqualTo("SQLite"));
            Assert.That(connection, Is.TypeOf <SQLiteConnection>());
            Assert.That(dialect, Is.SameAs(SQLiteDialect.Instance));

            Assert.That(scriptBuilder, Is.TypeOf <SQLiteScriptBuilder>());
            Assert.That(scriptBuilder.CurrentOpeningIdentifierDelimiter, Is.EqualTo('['));

            Assert.That(dbInspector, Is.TypeOf <SQLiteInspector>());
            Assert.That(tableInspector, Is.TypeOf <SQLiteTableInspector>());
            Assert.That(cruder, Is.TypeOf <SQLiteCruder>());
            Assert.That(dbSerializer, Is.TypeOf <SQLiteSerializer>());

            // Finalize
            connection.Dispose();
            try
            {
                File.Delete(filePath);
            }
            catch
            {
                // dismiss
            }
        }
Esempio n. 3
0
        public Rotor(RotorSlot slot, int position, char[] connections, RotorType type, IEventAggregator eventAggregator, IUtilityFactory utilityFactory)
        {
            _utilityFactory = utilityFactory;

            Connections     = connections;
            Slot            = slot;
            PositionShift   = position;
            Type            = type;
            RotorAggregator = eventAggregator;
        }
        public void Members_DifferentArguments_HaveExpectedProps()
        {
            // Arrange
            IUtilityFactory utilityFactory = SqlServerUtilityFactory.Instance;

            // Act
            var dbProviderName = utilityFactory.DbProviderName;

            IDbConnection connection = utilityFactory.CreateConnection();

            connection.ConnectionString = TestHelper.ConnectionString;
            connection.Open();

            IDialect dialect = utilityFactory.GetDialect();

            IScriptBuilder scriptBuilder = utilityFactory.CreateScriptBuilder();

            IDbInspector dbInspector = utilityFactory.CreateDbInspector(connection);

            ITableInspector tableInspector = utilityFactory.CreateTableInspector(connection, "language");

            ICruder cruder = utilityFactory.CreateCruder(connection);

            IDbSerializer dbSerializer = utilityFactory.CreateDbSerializer(connection);

            // Assert
            Assert.That(dbProviderName, Is.EqualTo("SqlServer"));
            Assert.That(connection, Is.TypeOf <SqlConnection>());
            Assert.That(dialect, Is.SameAs(SqlServerDialect.Instance));

            Assert.That(scriptBuilder, Is.TypeOf <SqlServerScriptBuilder>());
            Assert.That(scriptBuilder.CurrentOpeningIdentifierDelimiter, Is.EqualTo('['));

            Assert.That(dbInspector, Is.TypeOf <SqlServerInspector>());
            Assert.That(tableInspector, Is.TypeOf <SqlServerTableInspector>());
            Assert.That(cruder, Is.TypeOf <SqlServerCruder>());
            Assert.That(dbSerializer, Is.TypeOf <SqlServerSerializer>());
        }
Esempio n. 5
0
 public ComponentFactory(IUtilityFactory utilityFactory)
 {
     InitializeDictionaries();
     UtilityFactory = utilityFactory;
 }
Esempio n. 6
0
        public Plugboard(Dictionary <char, char> connections, IUtilityFactory utilityFactory)
        {
            _utilityFactory = utilityFactory;

            Connections = connections;
        }
Esempio n. 7
0
 public Enigma(IEnigmaSettings enigmaSettings, IUtilityFactory utilityFactory)
 {
     _enigmaSettings = enigmaSettings;
     _utilityFactory = utilityFactory;
 }