Esempio n. 1
0
        public override IEnumerator RunTest()
        {
            MyUserUi userUiPresenter = new MyUserUi();

            userUiPresenter.targetView = gameObject.GetViewStack().GetLatestView();

            { // Load a first user into the UI by passing it through the presenter:
                var user1 = new MyUserModel()
                {
                    userName = "******", userAge = 4
                };
                yield return(userUiPresenter.LoadModelIntoView(user1).AsCoroutine());

                AssertV2.AreEqual("Carl", userUiPresenter.NameInputField().text);
                AssertV2.AreEqual("4", userUiPresenter.AgeInputField().text);
            }

            yield return(new WaitForSeconds(1f)); // Load another user into the UI:

            {                                     // Example of loading a second user in a separate asyn method "LoadUser2":
                yield return(LoadUser2(userUiPresenter).AsCoroutine());

                AssertV2.AreEqual("55", userUiPresenter.AgeInputField().text); // The age of user 2
            }
        }
Esempio n. 2
0
        public IEnumerator ExampleUsage()
        {
            MyUserUi userUiPresenter = new MyUserUi();

            userUiPresenter.targetView = ResourcesV2.LoadPrefab("MyUserUi1");

            { // Load a first user into the UI by passing it through the presenter:
                var user1 = new MyUserModel()
                {
                    userName = "******", userAge = 4
                };
                yield return(userUiPresenter.LoadModelIntoView(user1).AsCoroutine());

                Assert.AreEqual("Carl", userUiPresenter.NameInputField().text);
                Assert.AreEqual("4", userUiPresenter.AgeInputField().text);
            }

            yield return(new WaitForSeconds(0.5f)); // Load another user into the UI:

            {                                       // Example of loading a second user in a separate asyn method "LoadUser2":
                yield return(LoadUser2(userUiPresenter).AsCoroutine());

                Assert.AreEqual("55", userUiPresenter.AgeInputField().text); // The age of user 2
            }
        }
Esempio n. 3
0
        private async Task LoadUser2(MyUserUi userUiPresenter)
        {
            var user2 = new MyUserModel()
            {
                userName = "******", userAge = 55
            };
            await userUiPresenter.LoadModelIntoView(user2);

            AssertV2.AreEqual("Anna", userUiPresenter.NameInputField().text);
        }