public void RegisterNotification() { NotificationName notification = null; Action <INotificationArguments> action = null; var service = new Mock <IUserInterfaceService>(); { service.Setup(s => s.RegisterNotification(It.IsAny <NotificationName>(), It.IsAny <Action <INotificationArguments> >())) .Callback <NotificationName, Action <INotificationArguments> >( (n, o) => { notification = n; action = o; }); } var notificationNames = new Mock <INotificationNameConstants>(); { notificationNames.Setup(n => n.SystemShuttingDown) .Returns(new NotificationName("a")); } var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var facade = new ApplicationFacade(service.Object, notificationNames.Object, systemDiagnostics); var name = new NotificationName("bla"); Action <INotificationArguments> callback = o => { }; facade.RegisterNotification(name, callback); Assert.AreSame(name, notification); Assert.AreSame(callback, action); }
public void RegisterNotification() { NotificationName notification = null; Action<INotificationArguments> action = null; var service = new Mock<IUserInterfaceService>(); { service.Setup(s => s.RegisterNotification(It.IsAny<NotificationName>(), It.IsAny<Action<INotificationArguments>>())) .Callback<NotificationName, Action<INotificationArguments>>( (n, o) => { notification = n; action = o; }); } var notificationNames = new Mock<INotificationNameConstants>(); { notificationNames.Setup(n => n.SystemShuttingDown) .Returns(new NotificationName("a")); } var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var facade = new ApplicationFacade(service.Object, notificationNames.Object, systemDiagnostics); var name = new NotificationName("bla"); Action<INotificationArguments> callback = o => { }; facade.RegisterNotification(name, callback); Assert.AreSame(name, notification); Assert.AreSame(callback, action); }