public void Can_Build_From_Config() { const string Name = "Can_Build_From_Config"; // Register a StepRecorder instance which will be used // by the fake services to mark themselves initialized. // If any of them is missing from the StepRecorder, // the ClusterBuilder is not initializing a service. var c = new ClusterBuilder(Name) .FromConfiguration("Can_Build_From_Config") .Use .Service<StepRecorder>() .Register(); var cluster = c.Resolve<ICluster>(); var m = c.Resolve<StepRecorder>(); m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy"); Assert.IsType<_FailurePolicy>(c.Resolve<IFailurePolicy>()); Assert.IsType<_NodeLocator>(c.Resolve<INodeLocator>()); Assert.IsType<_ReconnectPolicy>(c.Resolve<IReconnectPolicy>()); Assert.Equal(10, ((_FailurePolicy)c.Resolve<IFailurePolicy>()).Property); Assert.Equal("10", ((_NodeLocator)c.Resolve<INodeLocator>()).Property); Assert.Equal(TimeSpan.FromSeconds(10), ((_ReconnectPolicy)c.Resolve<IReconnectPolicy>()).Property); ClusterManager.Shutdown(Name); }
public void Can_Build_From_Config() { const string Name = "Can_Build_From_Config"; // Register a StepRecorder instance which will be used // by the fake services to mark themselves initialized. // If any of them is missing from the StepRecorder, // the ClusterBuilder is not initializing a service. var c = new ClusterBuilder(Name) .FromConfiguration("Can_Build_From_Config") .Use .Service <StepRecorder>() .Register(); var cluster = c.Resolve <ICluster>(); var m = c.Resolve <StepRecorder>(); m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy"); Assert.IsType <_FailurePolicy>(c.Resolve <IFailurePolicy>()); Assert.IsType <_NodeLocator>(c.Resolve <INodeLocator>()); Assert.IsType <_ReconnectPolicy>(c.Resolve <IReconnectPolicy>()); Assert.Equal(10, ((_FailurePolicy)c.Resolve <IFailurePolicy>()).Property); Assert.Equal("10", ((_NodeLocator)c.Resolve <INodeLocator>()).Property); Assert.Equal(TimeSpan.FromSeconds(10), ((_ReconnectPolicy)c.Resolve <IReconnectPolicy>()).Property); ClusterManager.Shutdown(Name); }
public void Can_Build_Using_Extensions() { // Register a StepRecorder instance which will be used // by the fake services to mark themselves initialized. // If any of them is missing from the StepRecorder, // the ClusterBuilder is not initializing a service. const string Name = "Can_Build_Using_Extensions"; var c = new ClusterBuilder(Name) .Endpoints("127.0.0.1") .Use .Service<StepRecorder>() .FailurePolicy<_FailurePolicy>() .NodeLocator<_NodeLocator>() .ReconnectPolicy<_ReconnectPolicy>() .Register(); var cluster = c.Resolve<ICluster>(); var m = c.Resolve<StepRecorder>(); m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy"); ClusterManager.Shutdown(Name); }
public void Can_Build_Using_Extensions() { // Register a StepRecorder instance which will be used // by the fake services to mark themselves initialized. // If any of them is missing from the StepRecorder, // the ClusterBuilder is not initializing a service. const string Name = "Can_Build_Using_Extensions"; var c = new ClusterBuilder(Name) .Endpoints("127.0.0.1") .Use .Service <StepRecorder>() .FailurePolicy <_FailurePolicy>() .NodeLocator <_NodeLocator>() .ReconnectPolicy <_ReconnectPolicy>() .Register(); var cluster = c.Resolve <ICluster>(); var m = c.Resolve <StepRecorder>(); m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy"); ClusterManager.Shutdown(Name); }