コード例 #1
0
        public void test_methodName_withCertainState_shouldDoSomething(int[] given, int expected)
        {
            var target = new MaxProfit();
            var actual = target.solution(given);

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void Max_Profit_Should_Handle_Complex_Profit_Scenario()
        {
            MaxProfit subject = new  MaxProfit();

            int[] array = { 100, 200, 800, 600, 400, 1600, 950, 0, 1500, 2000 };

            Assert.Equal(2000, subject.solution(array));
        }
コード例 #3
0
        public void Max_Profit_Should_Handle_Max_Values()
        {
            MaxProfit subject = new  MaxProfit();

            int[] array = { 0, 0, 0, 0, 200000 };

            Assert.Equal(200000, subject.solution(array));
        }
コード例 #4
0
        public void Max_Profit_Should_Handle_Simple_Profit_Scenario()
        {
            MaxProfit subject = new  MaxProfit();

            int[] array = { 100, 200, 800, 600 };

            Assert.Equal(700, subject.solution(array));
        }
コード例 #5
0
        public void Max_Profit_Should_Handle_Negative_Values_And_No_Profits()
        {
            MaxProfit subject = new  MaxProfit();

            int[] array = { 5000, 0, 0, 0 };

            Assert.Equal(0, subject.solution(array));
        }
コード例 #6
0
        public void Max_Profit_Should_Identify_No_Profits()
        {
            MaxProfit subject = new  MaxProfit();

            int[] array = { 0, 0, 0, 0 };

            Assert.Equal(0, subject.solution(array));
        }
コード例 #7
0
        public void Max_Profit_Should_Handle_Empty_Array()
        {
            MaxProfit subject = new  MaxProfit();

            int[] array = { };

            Assert.Equal(0, subject.solution(array));
        }
コード例 #8
0
        private void Test(int[] A, int expectedResult)
        {
            var result = _maxProfit.solution(A);

            Assert.AreEqual(expectedResult, result);
        }
コード例 #9
0
 public void MaxprofitTest()
 {
     int[] numbers = new int[] { 23171, 21011, 21123, 21366, 21013, 21367 };
     Assert.IsTrue(profit.solution(numbers) == 356);
 }