public void DefaultFormatter()
        {
            NestedElementTranslationUnit translationUnit = new NestedTranslationUnit();

            Assert.IsInstanceOfType(translationUnit.Formatter, typeof(WhiteSpaceFormatter),
                string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceFormatter).Name));
            Assert.IsTrue(translationUnit.Formatter.GetType() == typeof(WhiteSpaceInvariantFormatter),
                string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceInvariantFormatter).Name));
        }
        public void DefaultFormatter()
        {
            NestedElementTranslationUnit translationUnit = new NestedTranslationUnit();

            Assert.IsInstanceOfType(translationUnit.Formatter, typeof(WhiteSpaceFormatter),
                                    string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceFormatter).Name));
            Assert.IsTrue(translationUnit.Formatter.GetType() == typeof(WhiteSpaceInvariantFormatter),
                          string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceInvariantFormatter).Name));
        }
Beispiel #3
0
        public void NestedElementAddsNestedElement2()
        {
            var translationUnit = new NestedTranslationUnit2();

            TestInitialNestingLevel(translationUnit);

            var nestedTranslationUnit = new NestedTranslationUnit();

            translationUnit.AddTranslationUnit(nestedTranslationUnit);
            TestNestingLevels(translationUnit, nestedTranslationUnit);
        }
        public void NestedElementAddsNestedElement()
        {
            var translationUnit = new NestedTranslationUnit();
            Assert.AreEqual(-1, translationUnit.NestingLevel,
                "At the beginning, for a class not calling the base constructor with automatic nesting level, nesting level should be the automatic one!");

            var nestedTranslationUnit = new NestedTranslationUnit();

            translationUnit.AddTranslationUnit(nestedTranslationUnit);
            Assert.AreEqual(0, nestedTranslationUnit.NestingLevel,
                "When adding to an automatic nested unit, nesting level should be 0!");
        }
Beispiel #5
0
        public void NestedElementAddsNestedElement()
        {
            var translationUnit = new NestedTranslationUnit();

            Assert.AreEqual(-1, translationUnit.NestingLevel,
                            "At the beginning, for a class not calling the base constructor with automatic nesting level, nesting level should be the automatic one!");

            var nestedTranslationUnit = new NestedTranslationUnit();

            translationUnit.AddTranslationUnit(nestedTranslationUnit);
            Assert.AreEqual(0, nestedTranslationUnit.NestingLevel,
                            "When adding to an automatic nested unit, nesting level should be 0!");
        }
        public void DefaultFormatterProvider()
        {
            NestedElementTranslationUnit translationUnit = new NestedTranslationUnit();

            Func<int, IFormatter> formatterProvider = translationUnit.FormatterProvider;
            Assert.IsNotNull(formatterProvider, "Formatter provider cannot be null!");

            IFormatter formatter = formatterProvider(0);
            Assert.IsNotNull(formatter, "Returned formatter cannot be null!");
            Assert.IsInstanceOfType(formatter, typeof(WhiteSpaceFormatter),
                string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceFormatter).Name));
            Assert.IsTrue(formatter.GetType() == typeof(WhiteSpaceInvariantFormatter),
                string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceInvariantFormatter).Name));
        }
        public void DefaultFormatterProvider()
        {
            NestedElementTranslationUnit translationUnit = new NestedTranslationUnit();

            Func <int, IFormatter> formatterProvider = translationUnit.FormatterProvider;

            Assert.IsNotNull(formatterProvider, "Formatter provider cannot be null!");

            IFormatter formatter = formatterProvider(0);

            Assert.IsNotNull(formatter, "Returned formatter cannot be null!");
            Assert.IsInstanceOfType(formatter, typeof(WhiteSpaceFormatter),
                                    string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceFormatter).Name));
            Assert.IsTrue(formatter.GetType() == typeof(WhiteSpaceInvariantFormatter),
                          string.Format("Default formatter should be of type {0}!", typeof(WhiteSpaceInvariantFormatter).Name));
        }
        public void NestedElementAddsNestedElement2()
        {
            var translationUnit = new NestedTranslationUnit2();
            TestInitialNestingLevel(translationUnit);

            var nestedTranslationUnit = new NestedTranslationUnit();

            translationUnit.AddTranslationUnit(nestedTranslationUnit);
            TestNestingLevels(translationUnit, nestedTranslationUnit);
        }