public void BoldCodesAreConvertedToBoldCommands()
 {
     var decoder = new ANSICommandsDecoder(null, new ANSICommandStateMachine());
     IANSICommand[] actualCommands = decoder.ConvertFromInternalFormat(ESC + "[1m" + ESC + "[22m");
     CollectionAssert.AreEqual(
             new IANSICommand[]
             {
                 new SetBoldCommand(true),
                 new SetBoldCommand(false)
             },
             actualCommands
         );
 }
 public void CharDecodesToCharCommand()
 {
     var decoder = new ANSICommandsDecoder(null, new ANSICommandStateMachine());
     IANSICommand[] actualCommands = decoder.ConvertFromInternalFormat("abc");
     CollectionAssert.AreEqual(
             new[]
             {
                 new CharHTMLCommand() {Char = 'a'},
                 new CharHTMLCommand() {Char = 'b'},
                 new CharHTMLCommand() {Char = 'c'}
             },
             actualCommands
         );
 }
 public void BackgroundCodeDecodedsToBackgroundCommand()
 {
     var decoder = new ANSICommandsDecoder(null, new ANSICommandStateMachine());
     IANSICommand[] actualCommands = decoder.ConvertFromInternalFormat("a" + ESC + "[46mb");
     CollectionAssert.AreEqual(
             new IANSICommand[]
             {
                 new CharHTMLCommand() {Char = 'a'},
                 new BackgroundColorCommand(Color.Cyan),
                 new CharHTMLCommand() {Char = 'b'}
             },
             actualCommands
         );
 }
 public void BogusCommandsAreIgnored()
 {
     var decoder = new ANSICommandsDecoder(null, new ANSICommandStateMachine());
     IANSICommand[] actualCommands = decoder.ConvertFromInternalFormat("a" + ESC + "[123b4");
     CollectionAssert.AreEqual(
             new IANSICommand[]
             {
                 new CharHTMLCommand() {Char = 'a'},
                 new CharHTMLCommand() {Char = ESC[0]},
                 new CharHTMLCommand() {Char = '1'},
                 new CharHTMLCommand() {Char = '2'},
                 new CharHTMLCommand() {Char = '3'},
                 new CharHTMLCommand() {Char = 'b'},
                 new CharHTMLCommand() {Char = '4'}
             },
             actualCommands
         );
 }
 public void ResetCodeIsDecodedToResetCommand()
 {
     var decoder = new ANSICommandsDecoder(null, new ANSICommandStateMachine());
     IANSICommand[] actualCommands = decoder.ConvertFromInternalFormat(ESC + "[0m");
     CollectionAssert.AreEqual(
             new IANSICommand[]
             {
                 new ResetCommand()
             },
             actualCommands
         );
 }
 public void LfIsDecodedToNewLine()
 {
     var decoder = new ANSICommandsDecoder(null, new ANSICommandStateMachine());
     IANSICommand[] actualCommands = decoder.ConvertFromInternalFormat("a\n");
     CollectionAssert.AreEqual(
             new IANSICommand[]
             {
                 new CharHTMLCommand() {Char = 'a'},
                 new NewLineHTMLCommand()
             },
             actualCommands
         );
 }
 public void CompositeCommandDecodesToCompositeCode()
 {
     var decoder = new ANSICommandsDecoder(null, new ANSICommandStateMachine());
     IANSICommand[] actualCommands = decoder.ConvertFromInternalFormat("a" + ESC + "[1;36mb");
     CollectionAssert.AreEqual(
             new IANSICommand[]
             {
                 new CharHTMLCommand() {Char = 'a'},
                 new SetBoldCommand(true),
                 new ForegroundColorCommand(Color.Cyan),
                 new CharHTMLCommand() {Char = 'b'}
             },
             actualCommands
         );
 }