public void Test_Construct_WithNotDirtyNotValidBO_ShouldCloseFormAndReturnCloseWithoutSaving() { //---------------Set up test pack------------------- IControlFactory factory = CreateControlFactoryWin(); var businessObject = CreateMockBO(false, false, true); //---------------Assert Precondition---------------- Assert.IsFalse(businessObject.Status.IsDirty); Assert.IsTrue(businessObject.Status.IsValid()); //---------------Execute Test ---------------------- ICloseBOEditorDialog dialogWin = new CloseBOEditorDialogWinFake(factory); dialogWin.ShowDialog(businessObject); //---------------Test Result ----------------------- Assert.AreEqual(CloseBOEditorDialogResult.CloseWithoutSaving, dialogWin.BOEditorDialogResult); }
public void Test_Construct_WithDirtyInvalidBO_ShouldDisableSaveAndCloseBtn() { //---------------Set up test pack------------------- IControlFactory factory = CreateControlFactoryWin(); var businessObject = CreateMockBO(false, true, false); //---------------Assert Precondition---------------- Assert.IsTrue(businessObject.Status.IsDirty); Assert.IsFalse(businessObject.Status.IsValid()); //---------------Execute Test ---------------------- ICloseBOEditorDialog dialogWin = new CloseBOEditorDialogWinFake(factory); dialogWin.ShowDialog(businessObject); //---------------Test Result ----------------------- Assert.IsFalse(dialogWin.SaveAndCloseBtn.Enabled, "Should be disabled"); Assert.IsTrue(dialogWin.CloseWithoutSavingBtn.Enabled); Assert.IsTrue(dialogWin.CancelCloseBtn.Enabled); }