public void VI_Should_Read_5_1()
 {
     using (var reader = new RomanStringReader("VI"))
     {
         Assert.That(reader.Read(), Is.EqualTo(5));
         Assert.That(reader.Read(), Is.EqualTo(1));
         Assert.That(reader.EndOfString, Is.True);
     }
 }
 public void Read_On_EOF_Should_Throw_InvalidOperationException()
 {
     using (var reader = new RomanStringReader(""))
     {
         reader.Read();
     }
 }
예제 #3
0
 public IEnumerable<int> Split()
 {
     using (var reader = new RomanStringReader(romanNumber))
     {
         while(!reader.EndOfString)
         {
             var value1 = reader.Read();
             var value2 = reader.Peek();
             bool isPrefixed = value1 < value2;
             var value = isPrefixed ? value2 - value1 : value1;
             if (isPrefixed)
                 reader.Skip();
             yield return value;
         }
     }
 }