Ejemplo n.º 1
0
 private static void AssertTokenizationTypes(TokenizationResult result, params Type[] types)
 {
     Assert.IsNull(result.Exception);
     Assert.IsTrue(result.UnmatchedCharactersLeft == 0);
     Assert.IsNotNull(result.Tokens);
     var tokens = result.Tokens.ToArray();
     Assert.AreEqual(tokens.Length, types.Length);
     for(var i = 0; i < tokens.Length; ++i)
     {
         Assert.AreSame(tokens[i].GetType(), types[i]);
     }
 }
Ejemplo n.º 2
0
 private static void AssertTokenizationValues(TokenizationResult result, params object[] values)
 {
     var tokens = result.Tokens.ToArray();
     Assert.AreEqual(tokens.Length, values.Length);
     CollectionAssert.AreEqual(values, tokens.Select(x => x.GetObjectValue()));
 }
Ejemplo n.º 3
0
 private static void AssertTokenizationResult(TokenizationResult result, int unmatchedCharacters, Type exception = null, params Type[] types)
 {
     if(exception != null)
     {
         Assert.AreEqual(result.Exception.GetType(), exception);
     }
     else
     {
         Assert.IsNull(result.Exception);
     }
     Assert.IsTrue(result.UnmatchedCharactersLeft == unmatchedCharacters);
     Assert.IsNotNull(result.Tokens);
     var tokens = result.Tokens.ToArray();
     Assert.AreEqual(tokens.Length, types.Length);
     for(var i = 0; i < tokens.Length; ++i)
     {
         Assert.AreSame(tokens[i].GetType(), types[i]);
     }
 }