예제 #1
0
 public static void Reset()
 {
     COMMANDS.Clear();
     READERS.Clear();
     ALIASES_READER = AddReader("SELECT MIAM_ID, IDENTIFIER, DATABASE_OBJECT_NAME FROM MIA_NAME_ALIASES");
     AddReader("SELECT MIAM_ID, MIAM_SERIALIZATION FROM MIA_TYPES");
     AddReader("SELECT MIAM_ID, MIAM_SERIALIZATION, CREATION_DATE FROM MIA_TYPES");
     AddReader("SELECT MIAM_ID, CREATION_DATE FROM MIA_TYPES");
     MockCore.Reset();
 }
예제 #2
0
        public static MockReader AddReader(string command, MockReader reader)
        {
            command = NormalizeSQL(command);
            IList <MockReader> readerList;

            if (!READERS.TryGetValue(command, out readerList))
            {
                readerList       = new List <MockReader>();
                READERS[command] = readerList;
            }
            readerList.Add(reader);
            return(reader);
        }
예제 #3
0
        public static MockReader GetReader(string sql, string formatterSql)
        {
            sql = NormalizeSQL(sql);
            IList <MockReader> readerList;

            if (!READERS.TryGetValue(sql, out readerList))
            {
                Assert.Fail("No DB reader for " + sql + " -> " + formatterSql);
            }
            if (readerList.Count == 0)
            {
                Assert.Fail("DB readers exhausted for " + sql + " -> " + formatterSql);
            }
            MockReader reader = readerList[0];

            readerList.RemoveAt(0);
            ServiceRegistration.Get <ILogger>().Info("Using reader" + (reader.Id > 0 ? " #" + reader.Id : "") + " for " + sql + " -> " + formatterSql);
            return(reader);
        }