示例#1
0
    public void UpdateContainer_IsItemCountCorrectAfterNewUpdateContainer()
    {
        DummyContainer       container  = CreateTestContainer();
        IEnumerable <Weapon> oldWeapons = CreateWeaponsList(5);

        container.UpdateContainer(oldWeapons);

        IEnumerable <Weapon> newWeapons = CreateWeaponsList(5);

        container.UpdateContainer(newWeapons);

        Assert.AreEqual(5, container.Items.Count());
    }
示例#2
0
    public void UpdateContainer_AreOldItemsNotFoundAfterNewUpdateContainer()
    {
        DummyContainer       container  = CreateTestContainer();
        IEnumerable <Weapon> oldWeapons = CreateWeaponsList(5);

        container.UpdateContainer(oldWeapons);

        IEnumerable <Weapon> newWeapons = CreateWeaponsList(5);

        container.UpdateContainer(newWeapons);

        LogAssert.ignoreFailingMessages = true;
        container.GetItem(oldWeapons.First());
        LogAssert.Expect(LogType.Error, new Regex(".*"));
    }
示例#3
0
    public IEnumerator UpdateContainer_AreOldItemsDestroyed()
    {
        DummyContainer       container  = CreateTestContainer();
        IEnumerable <Weapon> oldWeapons = CreateWeaponsList(5);

        container.UpdateContainer(oldWeapons);

        IEnumerable <Weapon> newWeapons = CreateWeaponsList(5);

        container.UpdateContainer(newWeapons);

        yield return(new WaitForEndOfFrame());

        Assert.AreEqual(5, GameObject.FindObjectsOfType <DummyItem>().Length);
    }
示例#4
0
    public void UpdateContainer_AreGameObjectsCorrectlySpawned()
    {
        DummyContainer       container = CreateTestContainer();
        IEnumerable <Weapon> weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);

        Assert.AreEqual(5, GameObject.FindObjectsOfType <DummyItem>().Length);
    }
示例#5
0
    public void UpdateContainer_IsItemCountCorrect()
    {
        DummyContainer       container = CreateTestContainer();
        IEnumerable <Weapon> weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);

        Assert.AreEqual(container.Items.Count(), 5);
    }
示例#6
0
    public void Clear_IsItemsEmpty()
    {
        DummyContainer       container = CreateTestContainer();
        IEnumerable <Weapon> weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);
        container.Clear();

        Assert.AreEqual(0, container.Items.Count());
    }
示例#7
0
    public void DestroyItem_IsItemDestroyed()
    {
        DummyContainer       container = CreateTestContainer();
        IEnumerable <Weapon> weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);
        container.DestroyItem(weapons.First());

        Assert.AreEqual(container.Items.Count(), 4);
    }
示例#8
0
    public void CreateItem_IsItemsCountIncreased()
    {
        DummyContainer       container = CreateTestContainer();
        IEnumerable <Weapon> weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);
        Weapon weapon = new Weapon();

        container.CreateItem(weapon);

        Assert.AreEqual(6, container.Items.Count());
    }
示例#9
0
    public void GetItem_IsNewItemNotFound()
    {
        LogAssert.ignoreFailingMessages = true;

        DummyContainer       container = CreateTestContainer();
        IEnumerable <Weapon> weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);
        Weapon nonAddedWeapon = new Weapon();

        container.GetItem(nonAddedWeapon);
        LogAssert.Expect(LogType.Error, new Regex(".*"));
    }
示例#10
0
    public void GetItem_IsItemSame()
    {
        DummyContainer       container = CreateTestContainer();
        IEnumerable <Weapon> weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);
        Weapon weapon = new Weapon();

        container.CreateItem(weapon);

        DummyItem item = container.GetItem(weapon);

        Assert.AreSame(weapon, item.Data);
    }
示例#11
0
    public void DestroyItem_IsItemsEmpty()
    {
        DummyContainer container = CreateTestContainer();
        List <Weapon>  weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);

        for (int i = 0; i < 5; i++)
        {
            Weapon weaponToDelete = weapons.First();
            container.DestroyItem(weaponToDelete);
            weapons.Remove(weaponToDelete);
        }

        Assert.AreEqual(0, container.Items.Count());
    }
示例#12
0
    public IEnumerator DestroyItem_AreItemGameObjectsDestroyed()
    {
        DummyContainer container = CreateTestContainer();
        List <Weapon>  weapons   = CreateWeaponsList(5);

        container.UpdateContainer(weapons);

        for (int i = 0; i < 5; i++)
        {
            Weapon weaponToDelete = weapons.First();
            container.DestroyItem(weaponToDelete);
            weapons.Remove(weaponToDelete);
        }

        yield return(new WaitForEndOfFrame());

        Assert.AreEqual(0, GameObject.FindObjectsOfType <DummyItem>().Length);
    }