public void GetStringTest_Null()
        {
            // Arrange
            var mock             = new Mock <DirectiveHandler>();
            DirectiveHandler sut = mock.Object;

            // Act
            string result = sut.GetString(null);
        }
Beispiel #2
0
        public void GetStringTest_ShortForm()
        {
            // Arrange
            Directive        directive    = new PageTypeDirective(PageType.Letter);
            string           expectedText = $"{{pagetype: letter}}";
            DirectiveHandler sut          = PageTypeHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        public void GetStringTest_ShortForm()
        {
            // Arrange
            Directive        directive    = new TitlesDirective(Alignment.Left);
            string           expectedText = $"{{titles: left}}";
            DirectiveHandler sut          = TitlesHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        public void GetStringTest_ShortForm()
        {
            // Arrange
            string           color        = "red";
            Directive        directive    = new ChordColourDirective(color);
            string           expectedText = $"{{chordcolour: {color}}}";
            DirectiveHandler sut          = ChordColourHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        public void GetStringTest_ShortForm()
        {
            // Arrange
            string           subtitle     = "some subtitle";
            Directive        directive    = new SubtitleDirective(subtitle);
            string           expectedText = $"{{st: {subtitle}}}";
            DirectiveHandler sut          = SubtitleHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
Beispiel #6
0
        public void GetStringTest_ShortForm()
        {
            // Arrange
            string           fontFamily   = "times";
            Directive        directive    = new TextFontDirective(fontFamily);
            string           expectedText = $"{{tf: {fontFamily}}}";
            DirectiveHandler sut          = TextFontHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        public void GetStringTest_ShortForm()
        {
            // Arrange
            string           comment      = "some comment";
            Directive        directive    = new CommentItalicDirective(comment);
            string           expectedText = $"{{ci: {comment}}}";
            DirectiveHandler sut          = CommentItalicHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
Beispiel #8
0
        public void GetStringTest_ShortForm()
        {
            // Arrange
            int              number       = 3;
            Directive        directive    = new ColumnsDirective(number);
            string           expectedText = $"{{col: {number}}}";
            DirectiveHandler sut          = ColumnsHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
Beispiel #9
0
        public void GetStringTest_ShortForm()
        {
            // Arrange
            int              fontSize     = 9;
            Directive        directive    = new TextSizeDirective(fontSize);
            string           expectedText = $"{{ts: {fontSize}}}";
            DirectiveHandler sut          = TextSizeHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
Beispiel #10
0
        public void GetStringTest_LongForm()
        {
            // Arrange
            int              fontSize     = 9;
            Directive        directive    = new ChordSizeDirective(fontSize);
            string           expectedText = $"{{chordsize: {fontSize}}}";
            DirectiveHandler sut          = ChordSizeHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: false);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        public void GetStringTest_LongForm()
        {
            // Arrange
            string           fontFamily   = "times";
            Directive        directive    = new ChordFontDirective(fontFamily);
            string           expectedText = $"{{chordfont: {fontFamily}}}";
            DirectiveHandler sut          = ChordFontHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: false);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        public void GetStringTest_LongForm()
        {
            // Arrange
            string           comment      = "some comment";
            Directive        directive    = new CommentBoxDirective(comment);
            string           expectedText = $"{{comment_box: {comment}}}";
            DirectiveHandler sut          = CommentBoxHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: false);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        public void GetStringTest_LongForm()
        {
            // Arrange
            string           title        = "some title";
            Directive        directive    = new TitleDirective(title);
            string           expectedText = $"{{title: {title}}}";
            DirectiveHandler sut          = TitleHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: false);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
Beispiel #14
0
        public void GetStringTest_ShortForm()
        {
            // Arrange
            string           chord        = "X";
            string           definition   = "some definition";
            Directive        directive    = new DefineDirective(chord, definition);
            string           expectedText = $"{{define {chord}: {definition}}}";
            DirectiveHandler sut          = DefineHandler.Instance;

            // Act
            string text = sut.GetString(directive, shorten: true);

            // Assert
            Assert.AreEqual(expectedText, text);
        }
        private void DoGetStringTest(string longName, string shortName, string subkey, string value, bool shorten, string expected)
        {
            // Arrange
            Directive directive = new Mock <Directive>().Object;

            var mock = new Mock <DirectiveHandler>();

            mock.Protected().Setup <string>("GetSubKey", ItExpr.IsAny <Directive>()).Returns(subkey);
            mock.Protected().Setup <string>("GetValue", ItExpr.IsAny <Directive>()).Returns(value);
            mock.Setup(h => h.LongName).Returns(longName);
            mock.Setup(h => h.ShortName).Returns(shortName);
            mock.Setup(h => h.SubKey).Returns(ComponentPresence.Optional);
            mock.Setup(h => h.Value).Returns(ComponentPresence.Optional);

            DirectiveHandler sut = mock.Object;

            // Act
            string result = sut.GetString(directive, shorten);

            // Assert
            Assert.AreEqual(expected, result);
        }