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); }
public void PositionValuePositive() { QuoteFeedMock quoteFeedMock = new QuoteFeedMock(); Quote quote = new Quote() { Date = new DateTime(2000, 1, 1), Price = 50.00m, Symbol = "test", }; quoteFeedMock.AddQuote(quote); Position position = new Position() { Symbol = "test", Quantity = 10, Class = TransactionEnums.TransactionClass.stock, }; decimal expectedPositionValue = 500m; decimal actualPositionValue = Metrics.PositionValue(position, quoteFeedMock); Assert.AreEqual(expectedPositionValue, actualPositionValue); }
public void AccountValueZero() { QuoteFeedMock quoteFeedMock = new QuoteFeedMock(); Account account = new Account(); decimal expectedValue = 0m; decimal actualValue = Metrics.AccountValue(account, quoteFeedMock); Assert.AreEqual(expectedValue, actualValue); }
public void PositionValueZero() { QuoteFeedMock quoteFeedMock = new QuoteFeedMock(); Position position = new Position() { Symbol = "test", Quantity = 0, Class = TransactionEnums.TransactionClass.stock, }; Metrics.PositionValue(position, quoteFeedMock); }