public void NotificationChain_Finish_with_params_should_execute_callbacks() { var callback2_SenderExpected = this; var callback2_PropertyNameActual = Guid.NewGuid().ToString(); object callback2_Sender = null; string callback2_PropertyName = null; string callback2_DependentPropertyName = null; var callback1_WasCalled = false; var callback2_WasCalled = false; Chain.AndCall(() => callback1_WasCalled = true) .AndCall((sender, property, dependentProperty) => { callback2_WasCalled = true; callback2_Sender = sender; callback2_PropertyName = property; callback2_DependentPropertyName = dependentProperty; }) .Finish(callback2_SenderExpected, callback2_PropertyNameActual); Assert.True(callback1_WasCalled, nameof(callback1_WasCalled)); Assert.True(callback2_WasCalled, nameof(callback2_WasCalled)); Assert.Equal(callback2_SenderExpected, callback2_Sender); Assert.Equal(callback2_PropertyNameActual, callback2_PropertyName); Assert.Equal(DependentPropertyName, callback2_DependentPropertyName); }
private void Act() { Chain.OnRegex(ObservingRegex); Chain.AndCall((sender, notifyingProperty, dependentProperty) => { ChainCallbackCalled = true; ChainNotifications.Add(new Tuple <object, string, string>(sender, notifyingProperty, dependentProperty)); }); Chain.Publish(Sender, new PropertyChangedEventArgs(NotifyingProperty)); }
public void NotificationChain_Finish_with_true_param_should_execute_callbacks() { var callback1_WasCalled = false; var callback2_WasCalled = false; Chain.AndCall(() => callback1_WasCalled = true) .AndCall(() => callback2_WasCalled = true) .Finish(true); Assert.True(callback1_WasCalled, nameof(callback1_WasCalled)); Assert.True(callback2_WasCalled, nameof(callback2_WasCalled)); }
public void NotificationChain_Execute_with_no_params_should_execute_callbacks() { var callback1_WasCalled = false; var callback2_WasCalled = false; Chain.AndCall(() => callback1_WasCalled = true); Chain.AndCall(() => callback2_WasCalled = true); Chain.Execute(); Assert.True(callback1_WasCalled, nameof(callback1_WasCalled)); Assert.True(callback2_WasCalled, nameof(callback2_WasCalled)); }