コード例 #1
0
        public void PriceStaysTheSameAllDayTest()
        {
            var actual   = Greedy.AppleStocks(new int[] { 1, 1, 1, 1 });
            var expected = 0;

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void PriceGoesDownAllDayTest()
        {
            var actual   = Greedy.AppleStocks(new int[] { 9, 7, 4, 1 });
            var expected = -2;

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        public void PriceGoesUpAllDayTest()
        {
            var actual   = Greedy.AppleStocks(new int[] { 1, 6, 7, 9 });
            var expected = 8;

            Assert.Equal(expected, actual);
        }
コード例 #4
0
        public void PriceGoesDownThenUpTest()
        {
            var actual   = Greedy.AppleStocks(new int[] { 7, 2, 8, 9 });
            var expected = 7;

            Assert.Equal(expected, actual);
        }
コード例 #5
0
        public void PriceGoesUpThenDownTest()
        {
            var actual   = Greedy.AppleStocks(new int[] { 1, 5, 3, 2 });
            var expected = 4;

            Assert.Equal(expected, actual);
        }
コード例 #6
0
 public void ExceptionWithEmptyPricesTest()
 {
     Assert.Throws <ArgumentException>(() => Greedy.AppleStocks(new int[] { }));
 }