public void IsCommentSymbolTest() { СCommentSymbols target = BaseTest(); string[] pair_comment_symbols = { "/*", "*/" }; string[] not_pair_comment_symbols = { "//", "///" }; string[] non_comment_symbols = { "\\\\", "////", "rttt" }; bool IsNotPair = false; foreach (string symbol in pair_comment_symbols) { Assert.IsTrue(target.IsCommentSymbol(symbol, ref IsNotPair)); Assert.IsFalse(IsNotPair); } foreach (string symbol in not_pair_comment_symbols) { Assert.IsTrue(target.IsCommentSymbol(symbol, ref IsNotPair)); Assert.IsTrue(IsNotPair); } foreach (string symbol in non_comment_symbols) { Assert.IsFalse(target.IsCommentSymbol(symbol, ref IsNotPair)); Assert.IsTrue(IsNotPair); } }
// //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion private СCommentSymbols BaseTest() { СCommentSymbols target = new СCommentSymbols(comments); Assert.IsNotNull(target); return(target); }
public void CommentSymbolsTest() { CCodePreProcessingOptions target = BaseTest(); СCommentSymbols expected = new СCommentSymbols(comments); СCommentSymbols actual = target.CommentSymbols; Assert.AreEqual(actual, expected); }
public void SetCommentSymbolsTest() { СCommentSymbols target = new СCommentSymbols(); Assert.IsNotNull(target); target.SetCommentSymbols(comments); Assert.AreEqual(target.MinCommentLength, 2); Assert.AreEqual(target.MaxCommentLength, 3); target.SetCommentSymbols(string.Empty); }
public void ToArrayTest() { СCommentSymbols target = BaseTest(); string[] expected = { "//", string.Empty, "/*", "*/", "///", string.Empty }; string[] actual = target.ToArray(); Assert.AreEqual(expected.Length, actual.Length); for (int counter = 0; counter < actual.Length; counter++) { Assert.AreEqual(expected[counter], actual[counter]); } }
public void IsCommentCharTest() { СCommentSymbols target = BaseTest(); char[] comment_items = { '*', '/' }; foreach (char item in comment_items) { Assert.IsTrue(target.IsCommentChar(item)); } char[] non_comment_items = { '\r', '\\', '&' }; foreach (char item in non_comment_items) { Assert.IsFalse(target.IsCommentChar(item)); } }
private void CommentListTest() { СCommentSymbols actual = new СCommentSymbols(); Assert.IsNotNull(actual); actual.AddCommentInList(new CPair <string>("//", string.Empty)); actual.AddCommentInList(new CPair <string>("/*", "*/")); actual.AddCommentInList(new CPair <string>("///", string.Empty)); СCommentSymbols expected = BaseTest(); Assert.IsNotNull(expected); Assert.AreEqual(expected.GetCommentSymbolsList().Count, 3); Assert.AreEqual(expected.GetCommentSymbolsList().Count, actual.GetCommentSymbolsList().Count); for (int counter = 0; counter < expected.GetCommentSymbolsList().Count; counter++) { Assert.AreEqual(expected.GetCommentSymbolsList()[counter], actual.GetCommentSymbolsList()[counter]); } }
public void MinCommentLengthTest() { СCommentSymbols target = BaseTest(); Assert.AreEqual(target.MinCommentLength, 2); }
public void СCommentSymbolsConstructorTest() { СCommentSymbols target = BaseTest(); target = new СCommentSymbols(string.Empty); }