예제 #1
0
파일: Test_1_3.cs 프로젝트: jkrez/Interview
        public void Question_1_3_InPlace_EdgeCases()
        {
            TestHelpers.AssertExceptionThrown(() => Question_1_3.EscapeStringInplace(null, 0), typeof(ArgumentException));
            TestHelpers.AssertExceptionThrown(() => Question_1_3.EscapeStringInplace("  ".ToCharArray(), -1), typeof(ArgumentException));

            this.ValidateResultInPlace("", "");
        }
예제 #2
0
파일: Test_1_3.cs 프로젝트: jkrez/Interview
        private void ValidateResultInPlace(string expected, string input, int?inputLength = null)
        {
            var length    = inputLength ?? input.TrimEnd(' ').Length;
            var charArray = input.ToCharArray();

            Question_1_3.EscapeStringInplace(charArray, length);
            Assert.AreEqual(expected, string.Concat(charArray));
        }
        public void URLifyTest(string testStr, int trueLength, string expectedStr)
        {
            string result = Question_1_3.URLify(testStr, trueLength);

            Assert.AreEqual(expectedStr, result);
        }
예제 #4
0
파일: Test_1_3.cs 프로젝트: jkrez/Interview
 private void ValidateResult(string expected, string input)
 {
     Assert.AreEqual(expected, Question_1_3.EscapeString(input));
 }
예제 #5
0
파일: Test_1_3.cs 프로젝트: jkrez/Interview
 public void Question_1_3_InvalidInput()
 {
     TestHelpers.AssertExceptionThrown(() => Question_1_3.EscapeString(null), typeof(ArgumentException));
 }