public static UpdatableElement GetFakeTransaction(int number, int amount)
 {
     var lastUpdated = DateTime.Now.JavascriptTicks();
     var transaction = new Transaction()
     {
         amount = amount,
         comment = "Comment" + number,
         currency = "ccy" + number, @from = "from" + number, to = new []{"to" + number}, id = number.ToString(),
                                lastUpdated = lastUpdated
     };
     var jsonTransaction = JsonConvert.SerializeObject(transaction);
     return new UpdatableElement() { id = number.ToString(), lastUpdated = lastUpdated, SerializedValue = jsonTransaction };
 }
Beispiel #2
0
 public List<Transaction> getSkinnyTransactionSet(int qty)
 {
     Console.WriteLine(Environment.NewLine);
       Console.WriteLine("LOAD SKINNY TRANSACTION SET");
       var transactions = new List<Transaction>();
       for (int i = 1; i <= qty; i++)
       {
     var newTrans = new Transaction()
     {
       Amount = i,
       Comment = "Transaction no. " + i.ToString(),
       Identifier = "AA-" + i.ToString()
     };
     transactions.Add(newTrans);
       }
       return transactions;
 }
Beispiel #3
0
        public void _Deletes_Typed_Record()
        {
            _setup.CheckSetUp();
              var model = new DBTable(_connectionStringName, _testTableName, _tablePkColumn);
              var newRecord = new Transaction()
              {
            Amount = 100,
            Comment = "I Overspent!",
            Identifier = "XXX"
              };
              model.Insert(newRecord);
              int recordPk = newRecord.TransactionId;

              newRecord = model.Find<Transaction>(recordPk);
              int deleted = model.Delete(newRecord.TransactionId);
              newRecord = model.Find(recordPk);

              Assert.True(deleted > 0 && newRecord == null);
        }
Beispiel #4
0
        public void _Updates_Typed_Record()
        {
            _setup.CheckSetUp();
              var model = new DBTable(_connectionStringName, _testTableName, _tablePkColumn);
              var newRecord = new Transaction()
              {
            Amount = 100,
            Comment = "I Overspent!",
            Identifier = "XXX"
              };

              // Dump the new record in as an UPDATE:
              model.Insert(newRecord);
              int recordPk = newRecord.TransactionId;

              string newValue = "I changed it!";
              newRecord.Identifier = newValue;
              int updated = model.Update(newRecord);

              newRecord = model.Find<Transaction>(recordPk);

              Assert.True(updated > 0 && newRecord.Identifier == newValue);
        }
Beispiel #5
0
 public void _Inserts_Single_Typed_Record()
 {
     _setup.CheckSetUp();
       var newRecord = new Transaction()
       {
     Amount = 100,
     Comment = "I Overspent!",
     Identifier = "XXX"
       };
       var model = new DBTable(_connectionStringName, _testTableName, _tablePkColumn);
       var inserted = model.Insert(newRecord);
       Assert.True(newRecord.TransactionId > 0);
 }