コード例 #1
0
        public void WhenIProcessTheListForTheLargestOrderdList()
        {
            // Get the list saved in the Scenario context
            var intList = (int[])ScenarioContext.Current["LIST"];

            intList.Should().NotBeNullOrEmpty();

            var ttListOrdering   = new LL.ListManipulation();
            var largestOrderList = ttListOrdering.GetLargestOrderList(intList).ToArray();

            largestOrderList.Should().NotBeNullOrEmpty();
            // Extract the list to an array of integers and save in ScenarioContext
            if (ScenarioContext.Current.ContainsKey("LARGEST_LIST"))
            {
                ScenarioContext.Current.Remove("LARGET_LIST");
            }
            ScenarioContext.Current.Set(largestOrderList, "LARGEST_LIST");
        }
コード例 #2
0
        public static void Main()
        {
            // Have a 2D array of integers to test with
            var unorderInts = new[]
            {
                new[] { 1, 3, 5, 6, 3, 5, 6, 7, 8, 9, 0, 9 },
                new[] { 1, 2, 3, 4, 5, 6 },
                new[] { 0, 0, 0, 0 },
                new[] { -1, -2, -3, -2, -1, 0, 1, 5 }
            };

            var listmanipulation = new LL.ListManipulation();

            foreach (var intList in unorderInts)
            {
                var largestOrderList = listmanipulation.GetLargestOrderList(intList);

                Console.WriteLine($"The largest ordered list from ({string.Join(",",intList)}) is of length {largestOrderList.Count}, and the values are:-");
                Console.WriteLine($"({string.Join(",", largestOrderList)})");
                Console.WriteLine("\n\n");
            }

            Environment.Exit(0);
        }