public void ConstructorTestParams_InitialisesCorrectly() { Models.CalculationModel model = new CalculationModel("3", "500", "+"); Assert.AreEqual(model.FirstOperand,"3"); Assert.AreEqual(model.SecondOperand, "500"); Assert.AreEqual(model.Operation, "+"); Assert.AreEqual(model.Result, string.Empty); }
public void OperationTest_AddsCorrectly() { Models.CalculationModel model = new CalculationModel("3", "500", "+"); Assert.AreEqual(model.FirstOperand, "3"); Assert.AreEqual(model.SecondOperand, "500"); Assert.AreEqual(model.Operation, "+"); Assert.AreEqual(model.Result, string.Empty); model.CalculateResult(); Assert.AreEqual(model.Result, "503"); }
public void OperationTest_ArgumentException() { try { Models.CalculationModel model = new CalculationModel("3", "500", "~"); } catch (ArgumentException ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentException)); } }
public void OperationTest_TangentsCorrectly() { Models.CalculationModel model = new CalculationModel("-45", "tan"); Assert.AreEqual(model.FirstOperand, "-45"); Assert.AreEqual(model.Operation, "tan"); Assert.AreEqual(model.Result, string.Empty); model.CalculateResult(); Assert.AreEqual(model.Result, "-1"); }
public void OperationTest_SinesCorrectly() { Models.CalculationModel model = new CalculationModel("-45", "sin"); Assert.AreEqual(model.FirstOperand, "-45"); Assert.AreEqual(model.Operation, "sin"); Assert.AreEqual(model.Result, string.Empty); model.CalculateResult(); Assert.AreEqual(model.Result, "-0.707106781186547"); }
public void OperationTest_FormatException() { try { Models.CalculationModel model = new CalculationModel("BadData", "500", "+"); } catch(FormatException ex) { Assert.IsTrue(ex.GetType() == typeof(FormatException)); } }