Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions QueryKit.UnitTests/ArithmeticOperatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,9 @@ namespace QueryKit.UnitTests;

public class ArithmeticOperatorTests
{
[Theory]
[InlineData("+", "+")]
[InlineData("-", "-")]
[InlineData("*", "*")]
[InlineData("/", "/")]
[InlineData("%", "%")]
public void from_symbol_returns_the_operator_for_the_symbol(string symbol, string expectedSymbol)
{
var op = ArithmeticOperator.FromSymbol(symbol);

op.Should().NotBeNull();
op!.Symbol.Should().Be(expectedSymbol);
}

[Fact]
public void from_symbol_returns_null_for_an_unknown_symbol()
public void from_symbol_is_not_part_of_the_public_api()
{
var op = ArithmeticOperator.FromSymbol("^");

op.Should().BeNull();
typeof(ArithmeticOperator).GetMethod("FromSymbol").Should().BeNull();
}
}
10 changes: 0 additions & 10 deletions QueryKit/Operators/ArithmeticOperator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ protected ArithmeticOperator(string symbol, int precedence)
public static ArithmeticOperator Multiply => new MultiplyOperator();
public static ArithmeticOperator Divide => new DivideOperator();
public static ArithmeticOperator Modulo => new ModuloOperator();

public static ArithmeticOperator? FromSymbol(string symbol) => symbol switch
{
"+" => Add,
"-" => Subtract,
"*" => Multiply,
"/" => Divide,
"%" => Modulo,
_ => null
};
}

internal class AddOperator : ArithmeticOperator
Expand Down
Loading