void AddUsingInvalidInputTest()
        {
            _engine.Reset();

            try
            {
                _engine.AddUsings("Invalid input");
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is ArgumentException);
                Assert.IsTrue(_engine.AllUsings.Count == 0 && _engine.AllReferencedAssemblies.Count == 1);
            }
        }
Example #2
0
    void CompileCoroutineTest()
    {
        _engine.Reset();

        //Setup
        string code =
            @"
                GameObject gob = new GameObject(""DynamicallyCreatedGO"");
                yield return null;
            ";

        _engine.AddUsings("using UnityEngine;");

        //Action
        StartCoroutine(_engine.CompileCoroutine(code).GetEnumerator());

        //Assert
        GameObject go = GameObject.Find("DynamicallyCreatedGO");

        Assert.IsTrue(go != null);

        //TearDown
        Destroy(go);
    }