// ================================================================================================ // // XmlCommentElementParserのテストクラスソース。 // // // Copyright (C) 2012 Honeplus. All rights reserved. // // Honeplus // ================================================================================================ namespace Honememo.Parsers { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; /// /// のテストクラスです。 /// [TestClass] public class XmlCommentElementParserTest { #region インタフェース実装メソッドテストケース /// /// メソッドテストケース。 /// [TestMethod] public void TestTryParse() { XmlCommentElementParser parser = new XmlCommentElementParser(); IElement comment; Assert.IsTrue(parser.TryParse("", out comment)); Assert.AreEqual("", comment.ToString()); Assert.IsTrue(parser.TryParse("", out comment)); Assert.AreEqual("", comment.ToString()); Assert.IsTrue(parser.TryParse("-->", out comment)); Assert.AreEqual("", comment.ToString()); Assert.IsTrue(parser.TryParse("", out comment)); Assert.AreEqual("", comment.ToString()); Assert.IsTrue(parser.TryParse("-->", out comment)); Assert.AreEqual("-->", comment.ToString()); Assert.IsTrue(parser.TryParse("", out comment)); Assert.AreEqual("", comment.ToString()); Assert.IsFalse(parser.TryParse("<--test-->", out comment)); Assert.IsNull(comment); Assert.IsFalse(parser.TryParse("<%--test--%>", out comment)); Assert.IsNull(comment); Assert.IsFalse(parser.TryParse("", out comment)); Assert.IsNull(comment); Assert.IsFalse(parser.TryParse(string.Empty, out comment)); Assert.IsNull(comment); Assert.IsFalse(parser.TryParse(null, out comment)); Assert.IsNull(comment); } /// /// メソッドテストケース。 /// [TestMethod] public void TestIsPossibleParse() { XmlCommentElementParser parser = new XmlCommentElementParser(); Assert.IsTrue(parser.IsPossibleParse('<')); Assert.IsFalse(parser.IsPossibleParse('[')); Assert.IsFalse(parser.IsPossibleParse('-')); Assert.IsFalse(parser.IsPossibleParse('/')); Assert.IsFalse(parser.IsPossibleParse('#')); } #endregion } }