Example #1
0
        public void AccountTransactionsReportsInsertAndUpdate()
        {
            var repo         = new AccountTransactionsReportsSqlRepository(_accountHistoryBrokerSettings, _log);
            var domainObject = new MarginTrading.AccountHistoryBroker.Repositories.Models.AccountTransactionsReport
            {
                Id                    = "Id",
                Date                  = DateTime.UtcNow,
                AccountId             = "AccountId",
                ClientId              = "ClientId",
                PositionId            = null,
                Comment               = "Comment",
                Type                  = "Buy",
                Amount                = -9999999999999999999999.9999989999,
                Balance               = 9999999999999999999999.9999989999,
                WithdrawTransferLimit = 0
            };

            // Insert
            Task.Run(async() =>
            {
                await repo.InsertOrReplaceAsync(domainObject);
            }).Wait();
            // Update
            Task.Run(async() =>
            {
                await repo.InsertOrReplaceAsync(domainObject);
            }).Wait();
        }
Example #2
0
        public void AccountTransactionsReportsInsertAndUpdate_ArithmeticException()
        {
            var repo         = new AccountTransactionsReportsSqlRepository(_accountHistoryBrokerSettings, _log);
            var domainObject = new MarginTrading.AccountHistoryBroker.Repositories.Models.AccountTransactionsReport
            {
                Id                    = "Id",
                Date                  = DateTime.UtcNow,
                AccountId             = "AccountId",
                ClientId              = "ClientId",
                PositionId            = null,
                Comment               = "Comment",
                Type                  = "Buy",
                Amount                = -9999999999999999999999.9999999999,
                Balance               = 9999999999999999999999.1,
                WithdrawTransferLimit = 0
            };

            // Arithmetic Exception
            Assert.ThrowsAsync <System.Exception>(async() => await repo.InsertOrReplaceAsync(domainObject));
        }