public void ShouldReturnCorrectResult()
            {
                var    problem = new Problem0014();
                object result  = problem.GetResult();

                result.Should().Be(837799);
            }
Example #2
0
        public void ComputeSolutionProblem14_WithUpperBound10_Returns9()
        {
            var upperBound     = 10;
            var expectedResult = 9;

            var result = new Problem0014(upperBound).ComputeSolution();

            result.Should().Be(expectedResult);
        }
        public void LongestCommonPrefix_HasCommonPrefix_ReturnPrefix()
        {
            var problem = new Problem0014();
            var strs    = new string[] { "flower", "flow", "flight" };

            var result = problem.LongestCommonPrefix(strs);

            Assert.AreEqual("fl", result);
        }
        public void LongestCommonPrefix_FirstElemIsLongerThanOthers_ReturnPrefix()
        {
            var problem = new Problem0014();
            var strs    = new string[] { "ab", "a" };

            var result = problem.LongestCommonPrefix(strs);

            Assert.AreEqual("a", result);
        }
        public void LongestCommonPrefix_OneElement_ReturnElement()
        {
            var problem = new Problem0014();
            var strs    = new string[] { "asd" };

            var result = problem.LongestCommonPrefix(strs);

            Assert.AreEqual("asd", result);
        }
        public void LongestCommonPrefix_EmptyArray_ReturnEmptyString()
        {
            var problem = new Problem0014();
            var strs    = new string[] { };

            var result = problem.LongestCommonPrefix(strs);

            Assert.AreEqual("", result);
        }
        public void LongestCommonPrefix_NoCommonPrefix_ReturnEmptyString()
        {
            var problem = new Problem0014();
            var strs    = new string[] { "dog", "racecar", "car" };

            var result = problem.LongestCommonPrefix(strs);

            Assert.AreEqual("", result);
        }