public void DispatchAddOnceTest() { int count = 0; testSignal.AddOnce((x) => { count++; }); testSignal.Dispatch(); testSignal.Dispatch(); Assert.True(count == 1); }
// Use this for initialization void Start() { Application.RegisterLogCallback(HandleLog); Context context = Miranda.Init(new ParentContext(), new OtherContext()); ExceptionSignal eS = context.Get <ExceptionSignal>(); eS.AddOnce((x) => { Debug.Log(x[0]); }); IObjectInject tA = context.Get <IObjectInject>(); tA.PrintAFew(); Debug.Log("+++++++++++++++++++++++++"); IObjectInject tAA = context.Get <IObjectInject>(); tAA.PrintAFew(); Debug.Log("+++++++++++++++++++++++++"); tAA.ChangeName("TESTINGOFSINGLETON"); tA.PrintAFew(); TestSignal testSignal = context.Get <TestSignal>(); testSignal.AddOnce((x) => { foreach (object o in x) { Debug.Log(o); } }); testSignal.Dispatch("A", "b", "C"); TestSignal anotherSignal = context.Get <TestSignal>(); anotherSignal.Dispatch(); }