public void UpdateNumberToSystem_HappyPathTest() { CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator(); TextBox textbox = null; Thread t = new Thread(() => { textbox = new TextBox(); calculatorOrchestrator.UpdateNumberToSystem(textbox, "1"); Assert.AreEqual("1", textbox.Text); }); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); }
public void ExecuteCE_HappyPathTest() { CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator(); TextBox textbox = null; Thread t = new Thread(() => { textbox = new TextBox(); calculatorOrchestrator.ExecuteCE(textbox); Assert.AreEqual(string.Empty, textbox.Text); Assert.AreEqual(string.Empty, calculatorOrchestrator.input); }); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); }
public void UpdateOperation_HappyPathTest() { CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator(); TextBox textbox = null; Thread t = new Thread(() => { textbox = new TextBox(); calculatorOrchestrator.input = "10"; calculatorOrchestrator.UpdateOperation(textbox, Operator.Add); Assert.AreEqual("", textbox.Text); }); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); }
public void ChangeSign_HappyPathTest() { CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator(); TextBox textbox = null; Thread t = new Thread(() => { textbox = new TextBox(); calculatorOrchestrator.input = "10"; calculatorOrchestrator.ChangeSign(textbox); Assert.AreEqual("-10", textbox.Text); }); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); }
public void ComputeResultDivide_HappyPathTest() { CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator(); TextBox textbox = null; Thread t = new Thread(() => { textbox = new TextBox(); calculatorOrchestrator.UpdateNumberToSystem(textbox, "10"); calculatorOrchestrator.UpdateOperation(textbox, Operator.Divide); calculatorOrchestrator.UpdateNumberToSystem(textbox, "2"); calculatorOrchestrator.ComputeResult(textbox); Assert.AreEqual("5", textbox.Text); }); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); }
public void UpdateNumberToSystem_ExceptionsTest() { CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator(); TextBox textbox = null; Thread t = new Thread(() => { try { calculatorOrchestrator.UpdateNumberToSystem(textbox, "1"); Assert.Fail("Expected exception not thrown"); } catch (Exception) { Assert.IsTrue(true); } }); t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); }