Exemplo n.º 1
0
    public IEnumerator SetOnMaintenance()
    {
        /*
         * ready for handle maintenance mode.
         * you can set the method which will be called on maintenance.
         */
        Autoya.Maintenance_SetOnMaintenance(
            MyOnMaintenance
            );

        // start connection -> Maintenance mode notification will return.
        Autoya.Http_Get(
            "https://github.com",
            (conId, data) =>
        {
            // do nothing.
        },
            (conId, code, reason, autoyaStatus) =>
        {
            // do nothing.
        }
            );

        yield return(WaitUntil(() => onMaintenanceCalled, () => { throw new TimeoutException("onMaintenanceCalled does not be called."); }));
    }
Exemplo n.º 2
0
    IEnumerator Start()
    {
        var authenticated = false;

        Autoya.Auth_SetOnAuthenticated(
            () =>
        {
            authenticated = true;
        }
            );

        while (!authenticated)
        {
            yield return(null);
        }

        // test method for set fake maintenance mode.
        Autoya.forceMaintenance = true;

        /*
         *              ready for handle maintenance mode.
         *              you can set the method which will be called on maintenance.
         */
        Autoya.Maintenance_SetOnMaintenance(
            MyOnMaintenance
            );

        // start connection -> Maintenance mode notification will return.
        Autoya.Http_Get(
            "https://github.com",
            (conId, data) =>
        {
            // do nothing.
        },
            (conId, code, reason, autoyaStatus) =>
        {
            /*
             *                      you can check if service is in maintenance mode or not from autoyaStatus.
             */
            var isUnderMaintenance = autoyaStatus.inMaintenance;
            Debug.Log("connection failed by maintenance:" + isUnderMaintenance);

            // reset for end test.
            Autoya.forceMaintenance = false;
        }
            );
    }
Exemplo n.º 3
0
    [MTest] public void SetOnMaintenance()
    {
        /*
         *     ready for handle maintenance mode.
         *     you can set the method which will be called on maintenance.
         */
        Autoya.Maintenance_SetOnMaintenance(
            MyOnMaintenance
            );

        // start connection -> Maintenance mode notification will return.
        Autoya.Http_Get(
            "https://github.com",
            (conId, data) => {
            // do nothing.
        },
            (conId, code, reason, autoyaStatus) => {
            // do nothing.
        }
            );

        WaitUntil(() => onMaintenanceCalled, 5, "onMaintenanceCalled does not be called.");
    }