public void CheckToken_TestReplacement_ReturnsExpected(string sourceCode, string token, int position, bool isToken) { //Don't know why, but NCrunch can't recognise this pattern of test. Run it manually though and you'll see it's fine. //Arrange TokenChecker tokenChecker = new TokenChecker(); //Act & Assert Assert.AreEqual(isToken, tokenChecker.CheckIsToken(sourceCode, token, position)); }
public void CheckIsToken_TokenPositionIsInvalid_ExceptionThrown(string sourceCode, string token, int position, string expectedError) { //Don't know why, but NCrunch can't recognise this pattern of test. Run it manually though and you'll see it's fine. //Arrange TokenChecker tokenChecker = new TokenChecker(); //Act Action action = () => tokenChecker.CheckIsToken(sourceCode, token, position); //Assert action.Should().Throw <ArgumentException>().WithMessage(expectedError); }
public void CheckIsToken_TokenIsInvalid_ExceptionThrown(string token, string expectedError) { //Don't know why, but NCrunch can't recognise this pattern of test. Run it manually though and you'll see it's fine. //Arrange TokenChecker tokenChecker = new TokenChecker(); //Act Action action = () => tokenChecker.CheckIsToken("The quick brown fox jumps over a lazy dog", token, 0); //Assert action.Should().Throw <ArgumentException>().WithMessage(expectedError); }