public void Clear_ClearingData_DataCleared() { var calc = new StackCalculator(); calc.Push(100); calc.Clear(); Expect(calc.Size, Is.EqualTo(0) ); }
public void Div_DivideByZero_ThrowsException() { var calc = new StackCalculator(); calc.Push(20); calc.Push(0); Exception e = Assert.Throws<DivideByZeroException>(() => calc.Div()); }
public void Div_DividingValues_ValuesDivided() { var calc = new StackCalculator(); calc.Push(200); calc.Push(100); calc.Div(); Expect(calc.Pop(), Is.EqualTo(200 / 100)); }
public void Add_AddingValues_ValuesAdded() { var calc = new StackCalculator(); calc.Push(100); calc.Push(200); calc.Add(); Expect(calc.Pop(), Is.EqualTo(300)); }
static void Main(string[] args) { IStackCalculator sc = new StackCalculator(); sc.Push(12); sc.Pop(); Console.WriteLine("There are {0} values in the stack",sc.Size); sc.Push(10); sc.Push(20); sc.Push(30); Console.WriteLine("The 3 values in the stack are: {0} {1} {2}",sc[0],sc[1],sc[2]); Console.WriteLine("Badaboom!"); }
public void Index_ReturningValue_ValueReturned() { var calc = new StackCalculator(); calc.Push(10); Expect(calc[0], Is.EqualTo(10)); }
public void Index_IndexOutOfRange_ThrowsException() { var calc = new StackCalculator(); calc.Push(200); var i = calc[10]; }
public void Add_AddingWhereStackCountIsLessThanTwo_ThrowsException() { var calc = new StackCalculator(); calc.Push(100); Exception e = Assert.Throws<ArgumentException> ( () => calc.Add() ); }
public void Pop_InvalidMessage_PopsValueInEmptyStack_ThrowsException() { var calc = new StackCalculator(); Exception e = Assert.Throws<InvalidOperationException> ( () => calc.Pop() ); }
public void Swap_InvalidOperation_ThrowsException() { var calc = new StackCalculator(); //calc.Push(10); Exception e = Assert.Throws<InvalidOperationException>(() => calc.Swap()); }
public void Sub_SubstractingValues_ValuesSubstracted() { var calc = new StackCalculator(); calc.Push(100); calc.Push(200); calc.Sub(); Expect(calc.Pop(), Is.EqualTo(200-100)); }
public void RotateUp_MoveUpValues_ValuesMovedUp() { var calc = new StackCalculator(); calc.Push(20); calc.Push(30); calc.Push(40); calc.RotateUp(); Assert.AreEqual(calc.Pop(),30); }
public void RotateDown_MoveDownValues_ValuesMovedDown() { var calc = new StackCalculator(); calc.Push(20); calc.Push(30); calc.Push(40); calc.Push(50); calc.RotateDown(); Assert.AreEqual(calc.Pop(),20); }
public void Push_PushingValue_ValuePushed() { var calc = new StackCalculator(); calc.Push(100); Expect(calc.Size,Is.EqualTo(1)); }
public void Pop_PopsValue_ValuePopped() { var calc = new StackCalculator(); calc.Push(100); calc.Push(200); calc.Push(100); calc.Pop(); Expect(calc.Size, Is.EqualTo(2)); }
public void Mul_MultiplyingValues_ValuesMultiplied() { var calc = new StackCalculator(); calc.Push(100); calc.Push(200); calc.Mul(); Expect(calc.Pop(), Is.EqualTo(200*100)); }
public void Mul_MultiplyingWhereStackCountIsLessThanTwo_ThrowsException() { var calc = new StackCalculator(); calc.Push(200); Exception e = Assert.Throws<ArgumentException>(() => calc.Mul()); }
public void Swap_SwapValues_ValuesSwaped() { var calc = new StackCalculator(); calc.Push(100); calc.Push(200); calc.Swap(); Expect(calc.Pop(), Is.EqualTo(100)); }