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_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 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(); }