public void RemoveSafe_Listener_OnNotifying() { pObservableCollection_RemoveSafe_Test_Generic = new ObservableCollection_RefData <string>(); pObservableCollection_RemoveSafe_Test_Generic.Subscribe += TestRemoveSafe; Debug.Log("Edit : " + pObservableCollection_RemoveSafe_Test_Generic.DoNotify("Test")); }
public void IsNotOverlap_Observer() { ObservableCollection_RefData <int> pObserverSubject = new ObservableCollection_RefData <int>(); _iTestValue = 0; pObserverSubject.DoRegist_Listener(Plus_To_TestValue, 0); pObserverSubject.DoRegist_Listener(Plus_To_TestValue, 1); // Not Regist Assert.IsTrue(_iTestValue == 0); pObserverSubject.DoNotify(123); Assert.IsTrue(_iTestValue == 123); }
public void HasMultipleObserver_And_MustCall_In_Order() { ObservableCollection_RefData <int> pObserverSubject = new ObservableCollection_RefData <int>(); _iTestValue = 0; pObserverSubject.DoRegist_Listener(Plus_Current_To_TestValue, 2); pObserverSubject.DoRegist_Listener(Plus_10_Current, 0); pObserverSubject.DoRegist_Listener(Minus_20_Current, 1); Assert.IsTrue(_iTestValue == 0); pObserverSubject.DoNotify_ForDebug(100); // Result : 0 + (100 + 10 - 20) Assert.IsTrue(_iTestValue == (100 + 10 - 20)); }
public void Regist_And_Remove() { ObservableCollection_RefData <int> pObserverSubject = new ObservableCollection_RefData <int>(); _iTestValue = 0; pObserverSubject.DoRegist_Listener(Plus_To_TestValue, 0); pObserverSubject.DoRegist_Listener(Minus_To_TestValue, 1); pObserverSubject.DoRemove_Listener(Plus_To_TestValue); // Remove Plus & Minus Only Assert.IsTrue(_iTestValue == 0); pObserverSubject.DoNotify(10); // Minus Only Assert.IsTrue(_iTestValue == -10); }
public void HasMultipleObserver_And_GenericParams() { ObservableCollection_RefData <string, int> pObserverSubject = new ObservableCollection_RefData <string, int>(); _iTestValue = 0; pObserverSubject.DoRegist_Listener(AddField_HasParam, 1); Assert.IsTrue(_iTestValue == 0); pObserverSubject.DoNotify("테스트_A", 5); Assert.IsTrue(_iTestValue == 5); pObserverSubject.DoRegist_Listener(PrintLog_HasParam, 2); pObserverSubject.DoNotify("테스트_B", 8); Assert.IsTrue(_iTestValue == 5 + 8); pObserverSubject.DoRegist_Listener(Decrease_20_CurrentValue_HasParam, 0); pObserverSubject.DoNotify("테스트_C", 10); Assert.IsTrue(_iTestValue == 5 + 8 + (10 - 20)); }