public void DecimalValue() { double value; _calculator = new Calc(); _calculator.Parse("5.5"); value = _calculator.Result(); Assert.AreEqual(value, (double)5.5); }
public void Testmultipilicationmethod() { //arrange var calc = new Calc(); var result = calc.Mul(2, 4); //Assert Assert.AreEqual(8, result); }
public void NoOperator() { double value; _calculator = new Calc(); _calculator.Parse("5"); value = _calculator.Result(); Assert.AreEqual(value, (double)5); }
public void NoOperatorMultipleValues() { double value; _calculator = new Calc(); _calculator.Parse("5"); _calculator.Parse("5"); value = _calculator.Result(); }
public void Testadditionmethod() { //arrange var calc = new Calc(); var result = calc.Add(2, 4); //Assert Assert.AreEqual(6, result); }
public void SimpleAddition() { double value; _calculator = new Calc(); _calculator.ParseString("1+1"); value = _calculator.Result(); Assert.AreEqual(value, (double)2); }
public void ComplexParen() { double value; _calculator = new Calc(); _calculator.ParseString("2*(1+1)"); value = _calculator.Result(); Assert.AreEqual(value, (double)4); }
public void ParseStringWithSimpleParse() { double value; _calculator = new Calc(); _calculator.ParseString("5 + "); _calculator.Parse("5"); value = _calculator.Result(); Assert.AreEqual(value, (double)10); }
public void TestEmptyString() { //test logic here var calc = new Calc(); var result = calc.EmptyMethod(); Assert.IsNull(result); }
public MainWindow() { InitializeComponent(); c = new Calc(); textBox1.Text = defaultString; numberOneBuffer = ""; numberTwoBuffer = ""; }
public void ArithmicUnderflow() { double value; _calculator = new Calc(); _calculator.Parse(double.MinValue.ToString("R")); _calculator.Parse("-"); _calculator.Parse(double.MaxValue.ToString("R")); value = _calculator.Result(); }
public void DivideByZero() { double value; _calculator = new Calc(); _calculator.Parse("5"); _calculator.Parse("/"); _calculator.Parse("0"); value = _calculator.Result(); }
static void Main() { Calc c = new Calc(); int ans = c.Add(10, 84); Console.WriteLine("10 + 84 = {0}", ans); Console.ReadLine(); }
public void SimpleMultiply() { double value; _calculator = new Calc(); _calculator.Parse("5"); _calculator.Parse("*"); _calculator.Parse("5"); value = _calculator.Result(); Assert.AreEqual(value, (double)25); }
public void SimpleDivision() { double value; _calculator = new Calc(); _calculator.Parse("5"); _calculator.Parse("/"); _calculator.Parse("5"); value = _calculator.Result(); Assert.AreEqual(value, (double)1); }
public void SimpleSubtraction() { double value; _calculator = new Calc(); _calculator.Parse("5"); _calculator.Parse("-"); _calculator.Parse("5"); value = _calculator.Result(); Assert.AreEqual(value, (double)0); }
public void SimpleExponent() { double value; _calculator = new Calc(); _calculator.Parse("2"); _calculator.Parse("^"); _calculator.Parse("2"); value = _calculator.Result(); Assert.AreEqual(value, (double)4); }
public void OperatorParsing() { double value; _calculator = new Calc(); _calculator.Parse("5"); _calculator.Parse("+"); _calculator.Parse("5"); value = _calculator.Result(); Assert.AreEqual(value, (double)10); }
public void TestAdditionMethod() { //arranges the method var calc = new Calc(); //shows the action var result = calc.Add(2, 4); //Assert Assert.AreEqual(6, result); }
public void TestDivideMethod() { //arranges the method var calc = new Calc(); //shows the action var result = calc.Div(9, 3); //asserts whether the correct answer is the result Assert.AreEqual(3, result); }
public void TestMultiplymethod() { //arranges the method var calc = new Calc(); //shows the action var result = calc.Mul(2, 4); //Assert Assert.AreEqual(8, result); }
public void TestSubtractMethod() { //arranges the method var calc = new Calc(); //shows the action var result = calc.Sub(20, 5); //assert Assert.AreEqual(15, result); }
public void ComplexMultiply() { double value; double expected = 0; _calculator = new Calc(); _calculator.Parse("0"); for (double i = 1.5486154; i < 10; i++) { _calculator.Parse("*"); expected = expected * i; _calculator.Parse(i.ToString()); } value = _calculator.Result(); Assert.AreEqual(value, expected); }
public void ComplexSubtraction() { double value; double expected = 0; _calculator = new Calc(); _calculator.Parse("0"); for (double i = 1.5; i < 100; i++) { _calculator.Parse("-"); expected = expected - i; _calculator.Parse(i.ToString()); } value = _calculator.Result(); Assert.AreEqual(value, expected); }
static void Main(string[] args) { Calc _calculator = new Calc(); string equation; double lastResult = 0; while (true) { Console.WriteLine("Input your equation."); equation = Console.ReadLine().Trim(); if (!_calculator.Operators.ContainsKey(equation[0])) _calculator.Clear(); _calculator.ParseString(equation); lastResult = _calculator.Result(); Console.WriteLine("= " + lastResult.ToString()); } }
public void NoOperatorParseString() { _calculator = new Calc(); _calculator.ParseString("5 5"); _calculator.Result(); }
public MainWindow() { InitializeComponent(); Calculate = new Calc(); DataContext = Calculate; }
public void Setup() { uut = new Calc(); }
public MainWindow() { InitializeComponent(); calculator = new Calc(); }
public Append(Calc c) { this.c = c; }
public Calculate(Calc c) { this.c = c; }
public Operator(Calc c) { this.c = c; }
public Clear(Calc c) { this.c = c; }
public Backspace(Calc c) { this.c = c; }