public void ManagersValidityStateIsUpdatedOnSingleEditorUpdate() { var target = new EditableStruct { Text = "Initial" }; var editorB = Substitute.For <IDataEditor <EditableStruct> >(); var validator = CreateValidator(); _sut = new DataEditorsManager <EditableStruct, ValidationState>(validator) { editorB }; _sut.EditableTarget = target; // act _sut.MonitorEvents(); var updatedTarget = new EditableStruct { Text = "Updated" }; editorB.EditableTarget = updatedTarget; editorB.TargetUpdated += Raise.EventWith(EventArgs.Empty); // assert _sut.ShouldRaise("ValidationStateUpdated") .WithSender(_sut) .WithArgs <EventArgs>(a => a == EventArgs.Empty); }
public void ManagersValidityStateIsUpdatedOnTargetUpdate() { var target = new EditableStruct { Text = "Initial" }; var state = ValidationState.Valid; var validator = CreateValidator(state); _sut = new DataEditorsManager <EditableStruct, ValidationState>(validator); // act _sut.MonitorEvents(); _sut.EditableTarget = target; // assert _sut.ShouldRaise("ValidationStateUpdated") .WithSender(_sut) .WithArgs <EventArgs>(args => args == EventArgs.Empty); }