Beispiel #1
0
        public void CancelButtonClicked_Test()
        {
            // arrange
            var fakeView         = A.Fake <IMainWindow>();
            var fakeRepo         = A.Fake <IInvoiceRepository>();
            var fakeInvoiceModel = A.Fake <IInvoiceModel>();
            var presenter        = new MainPresenter(fakeView, fakeRepo, fakeInvoiceModel);

            presenter.NewInvoiceButtonClicked(null, null);

            // act
            presenter.CancelButtonClicked(null, null);

            // assert
            Assert.IsTrue(fakeView.NewInvoiceButtonEnabled);
            Assert.IsFalse(fakeView.SaveAndEmailButtonEnabled);
            Assert.IsFalse(fakeView.CancelButtonEnabled);
            Assert.IsFalse(fakeView.RadioButtonMonthlyEnabled);
            Assert.IsFalse(fakeView.RadioButtonCustomEnabled);
            Assert.IsFalse(fakeView.MonthComboboxEnabled);
            Assert.IsFalse(fakeView.YearTextBoxEnabled);
            Assert.IsFalse(fakeView.CustomTitleTextBoxEnabled);
            Assert.IsFalse(fakeView.ItemDescriptionTextBoxEnabled);
            Assert.IsFalse(fakeView.ItemAmountTextBoxEnabled);
            Assert.IsFalse(fakeView.ItemQuantityUpDownEnabled);
            Assert.IsFalse(fakeView.AddItemButtonEnabled);
            Assert.IsFalse(fakeView.ItemsListViewEnabled);
            Assert.IsFalse(fakeView.DuplicateItemButtonEnabled);
            Assert.IsFalse(fakeView.RemoveItemButtonEnabled);
            Assert.AreEqual("", fakeView.CustomTitleText);
            Assert.AreEqual("", fakeView.ItemDescription);
            Assert.AreEqual("", fakeView.ItemAmount);
            Assert.AreEqual("", fakeView.Year);
            Assert.AreEqual("", fakeView.Month);
            Assert.AreEqual(1, fakeView.ItemQuantity);
            Assert.AreEqual("0.00", fakeView.TotalText);
        }