Fixing tests - and all sorts of issues

This commit is contained in:
Stephan
2017-06-23 18:54:42 +02:00
parent 08ce8bc4dc
commit e87be7ad9d
57 changed files with 585 additions and 265 deletions

View File

@@ -7,27 +7,26 @@ namespace Umbraco.Core.Events
{
protected EventDefinitionBase(object sender, object args, string eventName = null)
{
if (sender == null) throw new ArgumentNullException("sender");
if (args == null) throw new ArgumentNullException("args");
Sender = sender;
Args = args;
Sender = sender ?? throw new ArgumentNullException(nameof(sender));
Args = args ?? throw new ArgumentNullException(nameof(args));
EventName = eventName;
if (EventName.IsNullOrWhiteSpace())
{
var findResult = EventNameExtractor.FindEvent(sender, args,
//don't match "Ing" suffixed names
exclude:EventNameExtractor.MatchIngNames);
// don't match "Ing" suffixed names
var findResult = EventNameExtractor.FindEvent(sender, args, exclude:EventNameExtractor.MatchIngNames);
if (findResult.Success == false)
throw new AmbiguousMatchException("Could not automatically find the event name, the event name will need to be explicitly registered for this event definition. Error: " + findResult.Result.Error);
throw new AmbiguousMatchException("Could not automatically find the event name, the event name will need to be explicitly registered for this event definition. "
+ $"Sender: {sender.GetType()} Args: {args.GetType()}"
+ " Error: " + findResult.Result.Error);
EventName = findResult.Result.Name;
}
}
public object Sender { get; private set; }
public object Args { get; private set; }
public string EventName { get; private set; }
public object Sender { get; }
public object Args { get; }
public string EventName { get; }
public abstract void RaiseEvent();