Пример #1
0
 public void BestTimeToBuyAndSellStockIITest(int expected, int[] prices)
 {
     if (prices.Length < 7)
     {
         Assert.Equal(expected, BestTimeToBuyAndSellStockII.MaxProfit(prices));
     }
     Assert.Equal(expected, BestTimeToBuyAndSellStockII.MaxProfitGreddy(prices));
 }
        public void MaxProfitTest()
        {
            //Arrange
            int[] prices = new int[] { 7, 1, 5, 3, 6, 4 };
            BestTimeToBuyAndSellStockII question = new BestTimeToBuyAndSellStockII();

            //Act
            var maxProfit = question.MaxProfit(prices);

            //Assert
            Assert.IsTrue(maxProfit == 7);
        }
Пример #3
0
 public void BeforeEach()
 {
     BestTimeToBuyAndSellStockII = new BestTimeToBuyAndSellStockII();
 }