예제 #1
0
    public IEnumerator BothWatchersAreNotifiedWhenFileIsModified()
    {
        DummyFileWatcher dfw  = new DummyFileWatcher();
        DummyFileWatcher dfw2 = new DummyFileWatcher();

        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().AddFile(dfw, path);
        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().EnableWatcher(dfw);

        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().AddFile(dfw2, path);
        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().EnableWatcher(dfw2);

        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().SimulateChange(path);
        yield return(null);

        yield return(null);

        Assert.IsTrue(dfw.changed);
        Assert.IsTrue(dfw2.changed);
    }
예제 #2
0
    public IEnumerator WatcherIsNotifiedOnceWhenFileIsModified()
    {
        DummyFileWatcher dfw = new DummyFileWatcher();

        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().AddFile(dfw, path);
        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().EnableWatcher(dfw);

        Unity.UIElements.Runtime.Editor.FileWatcher.Instance().SimulateChange(path);

        yield return(null);

        yield return(null);

        Assert.IsTrue(dfw.changed);

        dfw.changed = false;

        yield return(null);

        yield return(null);

        Assert.IsFalse(dfw.changed);
    }