﻿#if !NETFX_CORE
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using UnityEngine.SceneManagement;
using I2.Loc;
using UnityEngine.UI;
using System;
#pragma warning disable 618


public partial class I2Loc_PlayTest_Features
{
    [UnityTest, Category("Features")]
    public IEnumerator I2LocTest_Plural()
    {
        SceneManager.LoadScene("I2Localization    features Plurals");
        yield return null;

        var plural1 = I2Utils.FindObject( "Canvas/Localized Examples").GetChild(0).GetComponent<Text>();
        var plural2 = I2Utils.FindObject( "Canvas/Localized Examples").GetChild(1).GetComponent<Text>();
        var plural3 = I2Utils.FindObject( "Canvas/Localized Examples").GetChild(2).GetComponent<Text>();
        var plural4 = I2Utils.FindObject( "Canvas/Localized Examples").GetChild(3).GetComponent<Text>();

        I2Utils.FindObject( "Canvas/Buttons/Button Russian").GetComponent<SetLanguage>().ApplyLanguage();
        yield return null;

        Assert.IsTrue(plural1.text == "У вас нет очков.");
        Assert.IsTrue(plural2.text == "У вас есть 1 очко.");
        Assert.IsTrue(plural3.text == "У вас 4 балла.");
        Assert.IsTrue(plural4.text == "У вас 10 очков.");

        I2Utils.FindObject( "Canvas/Buttons/Button English").GetComponent<SetLanguage>().ApplyLanguage();
        yield return null;

        Assert.IsTrue(plural1.text == "You have no points");
        Assert.IsTrue(plural2.text == "You have 1 point");
        Assert.IsTrue(plural3.text == "You have 4 points");
        Assert.IsTrue(plural4.text == "You have 10 points");
    }
}

#endif