示例#1
0
        public void AccountValueOne()
        {
            Quote quote1 = new Quote()
            {
                Date   = new DateTime(2000, 1, 1),
                Price  = 10m,
                Symbol = "test1",
            };

            QuoteFeedMock quoteFeedMock = new QuoteFeedMock();

            quoteFeedMock.AddQuote(quote1);

            Position position1 = new Position()
            {
                Class    = TransactionEnums.TransactionClass.stock,
                Quantity = 5,
                Symbol   = "test1",
            };

            Account account = new Account();

            account.Positions.Add(position1.Symbol, position1);

            decimal expectedValue = 50m;
            decimal actualValue   = Metrics.AccountValue(account, quoteFeedMock);

            Assert.AreEqual(expectedValue, actualValue);
        }
示例#2
0
        public void AccountValueZero()
        {
            QuoteFeedMock quoteFeedMock = new QuoteFeedMock();
            Account       account       = new Account();

            decimal expectedValue = 0m;
            decimal actualValue   = Metrics.AccountValue(account, quoteFeedMock);

            Assert.AreEqual(expectedValue, actualValue);
        }