public void UnknownSign_ThrowsExceptions() { // Arrange var unknownOperator = 'x'; // Act var result = sut.Create(unknownOperator, 0); // Assert Assert.Fail("Should have thrown an exception"); }
public void GetMaxPrecedence() { List <MathToken> tokens = _lexer.GetTokens("3 + 3 * 2"); MathToken token = _precedence.GetMaxPrecedence(tokens); MathOperator op = OperatorFactory.Create(token.Token); Assert.AreEqual(op.Token, "*"); }
public void ThrowExceptionGivenNoOperator() { // Arrange OperatorFactory SystemUnderTest = new OperatorFactory(); string InvalidOperation = "1242&213124"; // Act + Assert Should.Throw <ArgumentException>(() => SystemUnderTest.Create(InvalidOperation)); }
public void CreateCorrectType(string operationText, Type createdType) { // Arrange OperatorFactory SystemUnderTest = new OperatorFactory(); // Act IOperator createdOperator = SystemUnderTest.Create(operationText); // Assert createdOperator.ShouldBeOfType(createdType); }
public void CreateDivisionOperator() { MathOperator op = OperatorFactory.Create("/"); Assert.AreEqual(op.Precedence, 2); }
public void CreateMultiplyOperator() { MathOperator op = OperatorFactory.Create("*"); Assert.AreEqual(op.Precedence, 2); }