public void EscapeSequenceAfterInterpolatedBlockIsExtracted()
 {
     String input = "$\"some{value}\\a\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(13,2), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void FormatSpecWithTypeIsExtracted()
 {
     String input = "\"" + @"Value: {0:c}" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(8, 5, StringPartType.FormatSpecifier), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void EscapedBackslashIsExtractedCorrectly()
 {
     String input = "\"" + @"some\\string" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(5,2), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void EscapeInSingleQuotesIsExtracted()
 {
     String input = @"'some\rstring'";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(5,2), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void IncompleteSpecIsIgnored()
 {
     String input = "\"" + @"Value: {0" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(null, parser.Next());
 }
 public void FormatSpecWithTypePrecisionAndAlignmentIsExtracted()
 {
     String input = "\"" + @"Value: {0,-3:x2}" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(8, 9, StringPartType.FormatSpecifier), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void FormatSpecsInInterpolatedStringsAreIgnored()
 {
     String input = "$\"" + @"Value: {0}" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(null, parser.Next());
 }
 public void FormatSpecInDoubleBracesIsIgnored()
 {
     String input = "\"" + @"Value: {{0}}" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(null, parser.Next());
 }
 public void X4EscapeSequenceIsExtracted()
 {
     String input = "\"" + @"some\x1234string" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(5,6), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void TwoSeparateEscapeSequencesAreExtracted()
 {
     String input = "\"" + @"some\rother\nstring" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(5,2), parser.Next());
       Assert.Equal(new StringPart(12,2), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void SimpleFormatSpecifierIsExtracted()
 {
     String input = "\"" + @"Hello {0}" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(new StringPart(7, 3, StringPartType.FormatSpecifier), parser.Next());
       Assert.Equal(null, parser.Next());
 }
 public void NoSequencesInInterpolatedAtStringAreExtracted()
 {
     String input = "$@\"" + @"some\rother\nstring" + "\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(null, parser.Next());
 }
 public void NoEscapesReturnsNull()
 {
     String input = "\"some string\"";
       var parser = new CSharpStringScanner(input);
       Assert.Equal(null, parser.Next());
 }