Esempio n. 1
0
        public void WhenInputIsOneThenImpossible()
        {
            var result = InvestPlan.Input(@"0
1
1 1 1 1 1 1 1 1 1 1 1 1").Output();

            Assert.AreEqual("Case 1: IMPOSSIBLE", result);
        }
Esempio n. 2
0
        public void WhenInputIs10ThenEmpty()
        {
            var result = InvestPlan.Input(@"0
10
1 2 3 1 1 1 1 1 1 1 1 1").Output();

            Assert.AreEqual("Case 1: 1 3 20", result);
        }
Esempio n. 3
0
        public void WhenMultipleInputsThenMultipleResults()
        {
            var result = InvestPlan.Input(@"0
10
1 2 3 1 1 1 1 1 1 1 1 1
20
1 5 10 2 1 6 1 1 2 20 1 1").Output();

            Assert.AreEqual("Case 1: 1 3 20\nCase 2: 1 10 380", result);
        }
Esempio n. 4
0
        public void WhenInputIsNullOrEmptyThenThrowException()
        {
            try
            {
                InvestPlan.Input(string.Empty).Output();
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("index", ex.ParamName);
                Assert.IsTrue(true);
            }

            try
            {
                InvestPlan.Input(null).Output();
            }
            catch (NullReferenceException)
            {
                Assert.IsTrue(true);
            }
        }
Esempio n. 5
0
        public void WhenInputIsOnlyZeroThenEmpty()
        {
            var result = InvestPlan.Input("0").Output();

            Assert.AreEqual(string.Empty, result);
        }