public void Test_SetCheckedWrappedCheckBox_SetsCheckedOnAdapter() { //---------------Set up test pack------------------- var checkBox = GenerateStub <CheckBox>(); var adapter = new WinFormsCheckBoxAdapter(checkBox); //---------------Assert Precondition---------------- Assert.AreSame(checkBox, adapter.WrappedControl); Assert.IsFalse(checkBox.Checked); //---------------Execute Test ---------------------- checkBox.Checked = true; //---------------Test Result ----------------------- Assert.IsTrue(adapter.Checked); }
public void Test_SetCheckedAlign_SetsCheckedOnWrappedCheckBox() { //---------------Set up test pack------------------- var checkBox = new CheckBox(); var adapter = new WinFormsCheckBoxAdapter(checkBox); checkBox.CheckAlign = ContentAlignment.BottomRight; //---------------Assert Precondition---------------- Assert.AreSame(checkBox, adapter.WrappedControl); Assert.AreEqual(ContentAlignment.BottomRight, checkBox.CheckAlign); Assert.AreEqual(ContentAlignment.BottomRight, adapter.CheckAlign); //---------------Execute Test ---------------------- adapter.CheckAlign = ContentAlignment.TopLeft; //---------------Test Result ----------------------- Assert.AreEqual(ContentAlignment.TopLeft, checkBox.CheckAlign); Assert.AreEqual(ContentAlignment.TopLeft, adapter.CheckAlign); }
public void Test_CheckedChanged_OnAdaptedControl_ShouldRaiseEventOnAdapter() { //---------------Set up test pack------------------- var checkBox = new CheckBox(); var adapter = new WinFormsCheckBoxAdapter(checkBox); bool checkChangedCalled = false; adapter.CheckedChanged += (sender, args) => checkChangedCalled = true; //---------------Assert Precondition---------------- Assert.AreSame(checkBox, adapter.WrappedControl); Assert.IsFalse(checkBox.Checked); Assert.IsFalse(checkChangedCalled); //---------------Execute Test ---------------------- adapter.Checked = true; //---------------Test Result ----------------------- Assert.IsTrue(checkChangedCalled); Assert.IsTrue(checkBox.Checked); }