示例#1
0
 public UnpublishPopupController(IUnpublishPopupView view)
 {
     this.view              = view;
     view.OnCancelPressed  += OnCancel;
     view.OnConfirmPressed += OnConfirmUnpublish;
     view.Hide();
 }
        public void ShowErrorCorrectly()
        {
            const string error = "Some Error";

            IUnpublishPopupView iview = view;

            iview.SetError("", error);
            Assert.AreEqual(error, view.errorText.text);

            Assert.IsFalse(view.loadingBarContainer.gameObject.activeSelf);
            Assert.IsFalse(view.cancelButton.gameObject.activeSelf);
            Assert.IsFalse(view.unpublishButton.gameObject.activeSelf);
            Assert.IsFalse(view.infoText.gameObject.activeSelf);
            Assert.IsTrue(view.doneButton.gameObject.activeSelf);
            Assert.IsTrue(view.errorText.gameObject.activeSelf);
            Assert.IsTrue(view.closeButton.gameObject.activeSelf);
        }
        public void ShowSuccessCorrectly()
        {
            const string success = "Some Success Message";

            IUnpublishPopupView iview = view;

            iview.SetSuccess("", success);
            Assert.AreEqual(success, view.infoText.text);

            Assert.IsTrue(view.infoText.gameObject.activeSelf);
            Assert.IsTrue(view.doneButton.gameObject.activeSelf);
            Assert.IsFalse(view.loadingBarContainer.gameObject.activeSelf);
            Assert.IsFalse(view.cancelButton.gameObject.activeSelf);
            Assert.IsFalse(view.unpublishButton.gameObject.activeSelf);
            Assert.IsFalse(view.errorText.gameObject.activeSelf);
            Assert.IsTrue(view.closeButton.gameObject.activeSelf);
        }
        public void ShowProgressCorrectly()
        {
            IUnpublishPopupView iview = view;

            iview.SetProgress("", 0);
            Assert.AreEqual("0%", view.loadingText.text);
            iview.SetProgress("", 0.5f);
            Assert.AreEqual("50%", view.loadingText.text);

            Assert.IsTrue(view.loadingBarContainer.gameObject.activeSelf);
            Assert.IsFalse(view.cancelButton.gameObject.activeSelf);
            Assert.IsFalse(view.unpublishButton.gameObject.activeSelf);
            Assert.IsFalse(view.infoText.gameObject.activeSelf);
            Assert.IsFalse(view.doneButton.gameObject.activeSelf);
            Assert.IsFalse(view.errorText.gameObject.activeSelf);
            Assert.IsFalse(view.closeButton.gameObject.activeSelf);
        }