Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Test Runner. Bug or not?

Discussion in 'Testing & Automation' started by alt3d, Nov 21, 2017.

  1. alt3d

    alt3d

    Joined:
    Aug 14, 2014
    Posts:
    4
    Why do this test succeed?
    I create two different gameObjects and take it transforms, why test think that are equals?

    [Test]
    public void TransformsTests()
    {
    var trnA = new GameObject("A").transform;
    var trnB = new GameObject("B").transform;
    Assert.AreEqual(trnA, trnB); // Not failed​
    }

    But if i change it, and take gameObjects instead transforms - it work fine and test failed.

    [Test]
    public void GameObjectsTests()
    {
    var goA = new GameObject("A");
    var goB = new GameObject("B");
    Assert.AreEqual(goA, goB); // Failed​
    }