Ejemplo n.º 1
0
        private IEnumerable login(TestGuest guest, Action <ISession> callback)
        {
            ISession              session   = null;
            bool                  done      = false;
            Action <ISession>     onSuccess = null;
            Action <ILoginResult> onFailed  = null;

            onSuccess = delegate(ISession s)
            {
                mixLoginCreateService.OnLoginSuccess -= onSuccess;
                mixLoginCreateService.OnLoginFailed  -= onFailed;
                session = s;
                done    = true;
            };
            onFailed = delegate
            {
                mixLoginCreateService.OnLoginSuccess -= onSuccess;
                mixLoginCreateService.OnLoginFailed  -= onFailed;
                IntegrationTest.Fail("Couldn't create a session");
                done = true;
            };
            mixLoginCreateService.OnLoginSuccess += onSuccess;
            mixLoginCreateService.OnLoginFailed  += onFailed;
            mixLoginCreateService.Login(guest.Username, guest.Password);
            while (!done)
            {
                yield return(null);
            }
            callback(session);
        }
Ejemplo n.º 2
0
        protected override IEnumerator setup()
        {
            yield return(base.setup());

            TestGuestBuilder testGuestBuilder = new TestGuestBuilder(networkServicesConfig.GuestControllerHostUrl, networkServicesConfig.DisneyIdClientId);
            TestGuest        aliceGuest       = null;
            TestGuest        bobGuest         = null;

            foreach (object item in testGuestBuilder.CreateChildAccount(delegate(TestGuest g)
            {
                aliceGuest = g;
            }))
            {
                _ = item;
                yield return(null);
            }
            foreach (object item2 in testGuestBuilder.CreateChildAccount(delegate(TestGuest g)
            {
                bobGuest = g;
            }))
            {
                _ = item2;
                yield return(null);
            }
            foreach (object item3 in login(aliceGuest, delegate(ISession s)
            {
                aliceSession = s;
            }))
            {
                _ = item3;
                yield return(null);
            }
            foreach (object item4 in login(bobGuest, delegate(ISession s)
            {
                bobSession = s;
            }))
            {
                _ = item4;
                yield return(null);
            }
            dataEntityCollection = createDataEntityCollection(aliceSession.LocalUser.DisplayName.Text);
            Service.Set(dataEntityCollection);
            friendsService = new FriendsService();
            createFriendsDataModelService(dataEntityCollection, friendsService);
            sessionManager.AddMixSession(aliceSession);
            friendsService.SetLocalUser(aliceSession.LocalUser);
        }
Ejemplo n.º 3
0
        private IEnumerable createAccount(Action <TestGuest> callback, string email, string lastName, string username, string parentEmail, string dateOfBirth, int numRetries)
        {
            RegisterRequest args = new RegisterRequest
            {
                legalAssertions = new List <string> {
                    "ppV2", "GTOU"
                },
                marketing = new List <MarketingItem>
                {
                    new MarketingItem
                    {
                        code       = "WDIGFamilySites",
                        subscribed = true
                    }
                },
                password = "******",
                profile  = new RegisterProfile
                {
                    dateOfBirth     = dateOfBirth,
                    email           = email,
                    username        = username,
                    parentEmail     = parentEmail,
                    firstName       = "CpIntTestFirstName",
                    lastName        = lastName,
                    testProfileFlag = "y",
                    region          = null
                }
            };
            WWW www = makeRegisterWww(args);

            while (!www.isDone)
            {
                yield return(null);
            }
            uint statusCode = getStatusCode(www.responseHeaders);

            if (statusCode >= 200 && statusCode <= 299)
            {
                string        responseText = www.text;
                LogInResponse response     = JsonMapper.ToObject <LogInResponse>(responseText);
                if (response.data != null && response.data.profile != null)
                {
                    TestGuest obj = new TestGuest(response.data, "CpIntTestPassword1");
                    callback(obj);
                }
                else if (numRetries < 2)
                {
                    foreach (object item in retryCreateAccount(callback, email, lastName, username, parentEmail, dateOfBirth, numRetries))
                    {
                        yield return(item);
                    }
                }
                else
                {
                    IntegrationTest.Fail("Got invalid data when creating TestGuest: " + JsonMapper.ToJson(response));
                    callback(null);
                }
            }
            else if (numRetries < 2)
            {
                foreach (object item2 in retryCreateAccount(callback, email, lastName, username, parentEmail, dateOfBirth, numRetries))
                {
                    yield return(item2);
                }
            }
            else
            {
                IntegrationTest.Fail("Error creating TestGuest: " + www.error + "\n" + www.text);
                callback(null);
            }
        }