Exemple #1
0
        public void _Writes_large_DataSet_to_Memory()
        {
            if (_transactions.Count() > 0)
            {
                _transactions.Clear();
            }
            var data = _setup.getSkinnyTransactionSet(_qtyCrapTons);

            // TODO: Should the flush back to the Db be implicit, or explicit?
            // It is currently implicit, and happens automatically. Maybe change this.
            _transactions.AddRange(data);
            Assert.True(_transactions.Count == _qtyCrapTons);
        }
Exemple #2
0
        public void MemoryDataExcercises(int qtyRecords)
        {
            // Start from fresh:
            this.DropTransctionTable();
            this.CreateTransctionTable();

            // Load the empty table:
            var transactions = new SQLServerList <Transaction>(_connectionString, _tableName, _tablePkName);

            transactions.Clear();

            var sw = new Stopwatch();

            sw.Start();

            // Insert a bunch of records:
            var data = this.getSkinnyTransactionSet(qtyRecords);

            transactions.AddRange(data);
            sw.Stop();
            this.LogOutput("Wrote", qtyRecords, sw.ElapsedMilliseconds);

            transactions = this.ReadTransactionTable();

            sw.Reset();
            sw.Start();

            // Find a record by arbitrary field (NOT the PK):
            var item = transactions.First(t => t.Identifier == "AA-9000");

            sw.Stop();
            this.LogOutput("Found single by field content", 1, sw.ElapsedMilliseconds);
            this.LogOutput("Found item: " + item.Identifier);


            sw.Reset();
            sw.Start();

            // Query against some criteria:
            var query = from t in transactions where (t.Amount > 100 && t.Amount < 150) select t;

            this.LogOutput("Read queried values from memory", query.Count(), sw.ElapsedMilliseconds);

            Console.WriteLine("Queried Values:");
            foreach (var trans in query)
            {
                this.LogOutput("Id: " + trans.TransactionId + " Comment: " + trans.Comment + " Amount: " + trans.Amount);
            }
            sw.Stop();
            this.LogOutput("Wrote queried values out to console", query.Count(), sw.ElapsedMilliseconds);
        }
Exemple #3
0
        public void ClearTransactionTable()
        {
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine("CLEAR TRANSACTIONS TABLE");

            var sw = new Stopwatch();

            sw.Start();
            var transactions = new SQLServerList <Transaction>(_connectionString, _tableName, _tablePkName);
            int count        = transactions.Count;

            sw.Stop();
            this.LogOutput("Read", count, sw.ElapsedMilliseconds);

            sw.Reset();
            sw.Start();
            transactions.Clear();
            sw.Stop();
            this.LogOutput("Cleared", count, sw.ElapsedMilliseconds);
        }