public void InvokeWithIdAndContextNotFullyFunctional() { var commands = new Mock <ICommandContainer>(); { commands.Setup(c => c.Invoke(It.IsAny <CommandId>(), It.IsAny <ICommandContext>())) .Verifiable(); } var notificationNames = new MockNotificationNameConstants(); var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var builder = new ContainerBuilder(); { builder.Register(c => commands.Object).As <ICommandContainer>(); builder.Register(c => notificationNames).As <INotificationNameConstants>(); builder.Register(c => systemDiagnostics).As <SystemDiagnostics>(); } Action <IContainer> onStartService = c => { }; var service = new UserInterfaceService( builder.Build(), onStartService, systemDiagnostics); Assert.Throws <ArgumentException>(() => service.Invoke(new CommandId("bla"), new Mock <ICommandContext>().Object)); }
public void InvokeWithIdAndContextFullyFunctional() { var commands = new Mock <ICommandContainer>(); { commands.Setup(c => c.Invoke(It.IsAny <CommandId>(), It.IsAny <ICommandContext>())) .Verifiable(); } var notificationNames = new MockNotificationNameConstants(); var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var builder = new ContainerBuilder(); { builder.Register(c => commands.Object).As <ICommandContainer>(); builder.Register(c => notificationNames).As <INotificationNameConstants>(); builder.Register(c => systemDiagnostics).As <SystemDiagnostics>(); } Action <IContainer> onStartService = c => { }; var service = new UserInterfaceService( builder.Build(), onStartService, systemDiagnostics); var proxy = new CoreProxy(new Mock <IKernel>().Object, systemDiagnostics); service.ConnectTo(proxy); ITimeline timeline = new Timeline(BuildStorage); var proxyLayer = new Mock <IProxyCompositionLayer>(); var projects = new ProjectService( () => timeline, d => new DatasetStorageProxy( d, new GroupSelector( new Mock <IConnectGroups>().Object, proxyLayer.Object), proxyLayer.Object), new Mock <IHelpDistributingDatasets>().Object, new Mock <ICollectNotifications>().Object, systemDiagnostics, new Mock <IBuildProjects>().Object); service.ConnectTo(projects); service.Start(); service.Invoke(new CommandId("bla"), new Mock <ICommandContext>().Object); commands.Verify(c => c.Invoke(It.IsAny <CommandId>(), It.IsAny <ICommandContext>()), Times.Exactly(1)); }
public void InvokeWithIdNotFullyFunctional() { var commands = new Mock<ICommandContainer>(); { commands.Setup(c => c.Invoke(It.IsAny<CommandId>())) .Verifiable(); } var notificationNames = new MockNotificationNameConstants(); var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var builder = new ContainerBuilder(); { builder.Register(c => commands.Object).As<ICommandContainer>(); builder.Register(c => notificationNames).As<INotificationNameConstants>(); builder.Register(c => systemDiagnostics).As<SystemDiagnostics>(); } Action<IContainer> onStartService = c => { }; var service = new UserInterfaceService( builder.Build(), onStartService, systemDiagnostics); Assert.Throws<ArgumentException>(() => service.Invoke(new CommandId("bla"))); }
public void InvokeWithIdFullyFunctional() { var commands = new Mock<ICommandContainer>(); { commands.Setup(c => c.Invoke(It.IsAny<CommandId>())) .Verifiable(); } var notificationNames = new MockNotificationNameConstants(); var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var builder = new ContainerBuilder(); { builder.Register(c => commands.Object).As<ICommandContainer>(); builder.Register(c => notificationNames).As<INotificationNameConstants>(); builder.Register(c => systemDiagnostics).As<SystemDiagnostics>(); } Action<IContainer> onStartService = c => { }; var service = new UserInterfaceService( builder.Build(), onStartService, systemDiagnostics); var proxy = new CoreProxy(new Mock<IKernel>().Object, systemDiagnostics); service.ConnectTo(proxy); ITimeline timeline = new Timeline(BuildStorage); var proxyLayer = new Mock<IProxyCompositionLayer>(); var projects = new ProjectService( () => timeline, d => new DatasetStorageProxy( d, new GroupSelector( new Mock<IConnectGroups>().Object, proxyLayer.Object), proxyLayer.Object), new Mock<IHelpDistributingDatasets>().Object, new Mock<ICollectNotifications>().Object, systemDiagnostics, new Mock<IBuildProjects>().Object); service.ConnectTo(projects); service.Start(); service.Invoke(new CommandId("bla")); commands.Verify(c => c.Invoke(It.IsAny<CommandId>()), Times.Exactly(1)); }