public void Create_should_create_event_name_from_name_and_type() { var a = EventName.Create("Hello", TypeName.Create("System", "EventHandler")); var b = EventName.Parse("Hello:System.EventHandler"); Assert.Equal(a, b); }
public void Create_should_create_event_name_from_name() { var a = EventName.Create("Hello"); var b = EventName.Parse("Hello"); Assert.Equal(a, b); }
public void AssociatedMember_creates_event_name_unspecified_parameters(string methodName) { var accessor = MethodName.Parse(methodName); var evt = EventName.Parse("INotifyPropertyChanged.PropertyChanged"); Assert.Equal(evt, accessor.AssociatedEvent); Assert.Equal(evt, accessor.AssociatedMember); }
public void AssociatedMember_creates_event_name_semantics(string methodName) { // We know the event's type based on the signature of the associated accessor var accessor = MethodName.Parse(methodName); var evt = EventName.Parse("INotifyPropertyChanged.PropertyChanged:EventHandler"); Assert.Equal(evt, accessor.AssociatedEvent); Assert.Equal(evt, accessor.AssociatedMember); }
public void AssociatedMember_creates_event_name_accessor_methods(string parameters, string eventName) { // When parameters are unspecified in an accessor, the generated event is likewise // unspecified. If we have a parameter, we can infer the event type var addon = MethodName.Parse("INotifyPropertyChanged.add_PropertyChanged" + parameters); var remover = MethodName.Parse("INotifyPropertyChanged.remove_PropertyChanged" + parameters); var raiser = MethodName.Parse("INotifyPropertyChanged.raise_PropertyChanged" + parameters); var evt = EventName.Parse(eventName); Assert.Equal(addon, evt.AddMethod); Assert.Equal(remover, evt.RemoveMethod); Assert.Equal(raiser, evt.RaiseMethod); }
public void Components(string text, EventNameComponents expected) { Assert.Equal(expected, EventName.Parse(text).Components); }