예제 #1
0
    public void RenderSubscribeTest()
    {
        var store  = new Store <State>(new State());
        var render = new SampleRender();

        store.AddRenderer(render.Render);

        store.Dispatch(new Action());
        store.ForceUpdate();
        Assert.AreEqual(1, render.Count);

        store.Dispatch(new Action());
        store.ForceUpdate();
        Assert.AreEqual(2, render.Count);

        store.RemoveRenderer(render.Render);

        store.Dispatch(new Action());
        store.ForceUpdate();
        Assert.AreEqual(2, render.Count);
    }
예제 #2
0
 public sample(string n, SampleRender r)
 {
     name = n;
     render = r;
 }