예제 #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));
        }