public void Allocation_AddTransaction_DepositCrypto()
        {
            Allocation  alloc = AllocationsTools.GetAllocation();
            Transaction DCtx  = new Transaction("ID_DC",
                                                TransactionType.Deposit,
                                                DateTime.UtcNow,
                                                null,
                                                new Price(0.1, Currency.XBT));
            Allocation newAlloc = alloc.AddTransaction(DCtx);

            Assert.AreEqual(newAlloc.GetElement(Currency.XBT).Amount, 1);
        }
        public void Allocation_AddTransaction_DepositFiat()
        {
            Allocation  alloc = AllocationsTools.GetAllocation();
            Transaction DFtx  = new Transaction("ID_DF",
                                                TransactionType.Deposit,
                                                DateTime.UtcNow,
                                                null,
                                                new Price(100, Currency.USD));
            Allocation newAlloc = alloc.AddTransaction(DFtx);

            Assert.AreEqual(newAlloc.GetElement(Currency.USD).Amount, 200);
        }
        public void Allocation_AddTransaction_WithDrawCrypto()
        {
            Allocation  alloc = AllocationsTools.GetAllocation();
            Transaction WCtx  = new Transaction("ID_WdCrypto",
                                                TransactionType.WithDrawal,
                                                DateTime.UtcNow,
                                                new Price(0.5, Currency.XBT),
                                                null,
                                                new Price(0.01, Currency.XBT));
            Allocation newAlloc = alloc.AddTransaction(WCtx);

            Assert.AreEqual(newAlloc.GetElement(Currency.XBT).Amount, 1 - 0.01);
        }
        public void Allocation_AddTransaction_WithDrawFiat()
        {
            Allocation  alloc = AllocationsTools.GetAllocation();
            Transaction WFtx  = new Transaction("ID_WDFiat",
                                                TransactionType.WithDrawal,
                                                DateTime.UtcNow,
                                                new Price(20, Currency.USD),
                                                null,
                                                new Price(2, Currency.USD));
            Allocation newAlloc = alloc.AddTransaction(WFtx);

            Assert.AreEqual(newAlloc.GetElement(Currency.USD).Amount, 100 - 20 - 2);
        }
        public void Allocation_AddTransaction_Trade()
        {
            Allocation  alloc = AllocationsTools.GetAllocation();
            Price       Fees  = new Price(50, Currency.USD);
            Transaction Ttx   = new Transaction("ID_Trade",
                                                TransactionType.Trade,
                                                DateTime.UtcNow,
                                                new Price(0.5, Currency.XBT),
                                                new Price(450, Currency.USD),
                                                Fees);
            Allocation newAlloc = alloc.AddTransaction(Ttx);
            bool       test1    = newAlloc.GetElement(Currency.XBT).Amount == 0.5;
            bool       test2    = newAlloc.GetElement(Currency.USD).Amount == 100 + 450 - 50;
            bool       test3    = newAlloc.Fees.Price.Equals(Fees);

            Assert.IsTrue(test1 && test2 && test3);
        }