Import code from previous AssetBuilder version

This commit is contained in:
Jan
2019-09-24 10:45:09 +02:00
parent 5609557516
commit 0d8432d4f7
919 changed files with 154412 additions and 26 deletions

View File

@ -0,0 +1,45 @@
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using ZoneCodeGenerator.Parsing;
using ZoneCodeGenerator.Parsing.Matching;
using ZoneCodeGenerator.Parsing.Matching.Matchers;
namespace ZoneCodeGeneratorTests.Parsing.Matching.Matchers
{
[TestClass]
public class MatcherGroupOptionalTest
{
private Mock<ILexer> lexerMock;
private MatchingContext matchingContext;
[TestInitialize]
public void Setup()
{
lexerMock = new Mock<ILexer>();
matchingContext = new MatchingContext(lexerMock.Object, new Dictionary<string, TokenMatcher>());
}
[TestMethod]
public void EnsureIsSuccessfulWhenMatcherIsSuccessful()
{
var matcherGroup = new MatcherGroupOptional(new TestMatcher(true, 5));
var result = matcherGroup.Test(matchingContext, 0);
Assert.IsTrue(result.Successful);
Assert.AreEqual(5, result.ConsumedTokenCount);
}
[TestMethod]
public void EnsureIsSuccessfulWhenMatcherIsUnsuccessful()
{
var matcherGroup = new MatcherGroupOptional(new TestMatcher(false, 0));
var result = matcherGroup.Test(matchingContext, 0);
Assert.IsTrue(result.Successful);
Assert.AreEqual(0, result.ConsumedTokenCount);
}
}
}